Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sycl-rel_5_2_0: [UR] CI for UR PR refactor-guess-local-worksize (#12663) #13407

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions libclc/ptx-nvidiacl/libspirv/atomic/atomic_add.cl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ Memory order is stored in the lowest 5 bits */
ADDR_SPACE, ADDR_SPACE_NV) \
} \
break; \
case SequentiallyConsistent: \
if (__clc_nvvm_reflect_arch() >= 700) { \
__CLC_NVVM_FENCE_SC_SM70() \
__CLC_NVVM_ATOMIC_IMPL_ORDER(double, double, d, add, ADDR_SPACE, \
ADDR_SPACE_NV, _acq_rel) \
break; \
} \
} \
__builtin_trap(); \
__builtin_unreachable(); \
Expand Down
8 changes: 8 additions & 0 deletions libclc/ptx-nvidiacl/libspirv/atomic/atomic_cmpxchg.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <atomic_helpers.h>
#include <spirv/spirv.h>
#include <spirv/spirv_types.h>

Expand Down Expand Up @@ -120,6 +121,13 @@ Memory order is stored in the lowest 5 bits */ \
TYPE, TYPE_NV, TYPE_MANGLED_NV, OP, ADDR_SPACE, ADDR_SPACE_NV) \
} \
break; \
case SequentiallyConsistent: \
if (__clc_nvvm_reflect_arch() >= 700) { \
__CLC_NVVM_FENCE_SC_SM70() \
__CLC_NVVM_ATOMIC_CAS_IMPL_ORDER(TYPE, TYPE_NV, TYPE_MANGLED_NV, OP, \
ADDR_SPACE, ADDR_SPACE_NV, _acq_rel) \
break; \
} \
} \
__builtin_trap(); \
__builtin_unreachable(); \
Expand Down
16 changes: 16 additions & 0 deletions libclc/ptx-nvidiacl/libspirv/atomic/atomic_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ _CLC_OVERLOAD _CLC_DECL void __spirv_MemoryBarrier(unsigned int, unsigned int);
} \
}

#define __CLC_NVVM_FENCE_SC_SM70() \
if (scope == CrossDevice) { \
__asm__ __volatile__("fence.sc.sys;"); \
} else if (scope == Device) { \
__asm__ __volatile__("fence.sc.gpu;"); \
} else { \
__asm__ __volatile__("fence.sc.cta;"); \
}

#define __CLC_NVVM_ATOMIC_IMPL( \
TYPE, TYPE_MANGLED, TYPE_NV, TYPE_MANGLED_NV, OP, NAME_MANGLED, \
ADDR_SPACE, POINTER_AND_ADDR_SPACE_MANGLED, ADDR_SPACE_NV, SUBSTITUTION) \
Expand Down Expand Up @@ -117,6 +126,13 @@ Memory order is stored in the lowest 5 bits */ \
OP, ADDR_SPACE, ADDR_SPACE_NV) \
} \
break; \
case SequentiallyConsistent: \
if (__clc_nvvm_reflect_arch() >= 700) { \
__CLC_NVVM_FENCE_SC_SM70() \
__CLC_NVVM_ATOMIC_IMPL_ORDER(TYPE, TYPE_NV, TYPE_MANGLED_NV, OP, \
ADDR_SPACE, ADDR_SPACE_NV, _acq_rel) \
break; \
} \
} \
__builtin_trap(); \
__builtin_unreachable(); \
Expand Down
7 changes: 7 additions & 0 deletions libclc/ptx-nvidiacl/libspirv/atomic/atomic_load.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <atomic_helpers.h>
#include <spirv/spirv.h>
#include <spirv/spirv_types.h>

Expand Down Expand Up @@ -53,6 +54,12 @@ Memory order is stored in the lowest 5 bits */ \
case Acquire: \
__CLC_NVVM_ATOMIC_LOAD_IMPL_ORDER(TYPE, TYPE_NV, TYPE_MANGLED_NV, \
ADDR_SPACE, ADDR_SPACE_NV, _acquire) \
break; \
case SequentiallyConsistent: \
__CLC_NVVM_FENCE_SC_SM70() \
__CLC_NVVM_ATOMIC_LOAD_IMPL_ORDER(TYPE, TYPE_NV, TYPE_MANGLED_NV, \
ADDR_SPACE, ADDR_SPACE_NV, _acquire) \
break; \
} \
} else { \
TYPE_NV res = __nvvm_volatile_ld##ADDR_SPACE_NV##TYPE_MANGLED_NV( \
Expand Down
8 changes: 8 additions & 0 deletions libclc/ptx-nvidiacl/libspirv/atomic/atomic_store.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <atomic_helpers.h>
#include <spirv/spirv.h>
#include <spirv/spirv_types.h>

Expand Down Expand Up @@ -54,6 +55,13 @@ Memory order is stored in the lowest 5 bits */ \
__CLC_NVVM_ATOMIC_STORE_IMPL_ORDER(TYPE, TYPE_NV, TYPE_MANGLED_NV, \
ADDR_SPACE, ADDR_SPACE_NV, \
_release) \
break; \
case SequentiallyConsistent: \
__CLC_NVVM_FENCE_SC_SM70() \
__CLC_NVVM_ATOMIC_STORE_IMPL_ORDER(TYPE, TYPE_NV, TYPE_MANGLED_NV, \
ADDR_SPACE, ADDR_SPACE_NV, \
_release) \
break; \
} \
} else { \
switch (order) { \
Expand Down
1 change: 1 addition & 0 deletions sycl/include/sycl/detail/pi.def
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ _PI_API(piDeviceRetain)
_PI_API(piDeviceRelease)
_PI_API(piextDeviceSelectBinary)
_PI_API(piextGetDeviceFunctionPointer)
_PI_API(piextGetGlobalVariablePointer)
_PI_API(piextDeviceGetNativeHandle)
_PI_API(piextDeviceCreateWithNativeHandle)
// Context
Expand Down
7 changes: 6 additions & 1 deletion sycl/include/sycl/detail/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@
// 15.44 Add coarse-grain memory advice flag for HIP.
// 15.45 Added piextKernelSuggestMaxCooperativeGroupCount and
// piextEnqueueCooperativeKernelLaunch.
// 15.46 Add piextGetGlobalVariablePointer

#define _PI_H_VERSION_MAJOR 15
#define _PI_H_VERSION_MINOR 45
#define _PI_H_VERSION_MINOR 46

#define _PI_STRING_HELPER(a) #a
#define _PI_CONCAT(a, b) _PI_STRING_HELPER(a.b)
Expand Down Expand Up @@ -1287,6 +1288,10 @@ __SYCL_EXPORT pi_result piextGetDeviceFunctionPointer(
pi_device device, pi_program program, const char *function_name,
pi_uint64 *function_pointer_ret);

__SYCL_EXPORT pi_result piextGetGlobalVariablePointer(
pi_device Device, pi_program Program, const char *GlobalVariableName,
size_t *GlobalVariableSize, void **GlobalVariablePointerRet);

//
// Context
//
Expand Down
9 changes: 9 additions & 0 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,15 @@ pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program,
FunctionPointerRet);
}

pi_result piextGetGlobalVariablePointer(pi_device Device, pi_program Program,
const char *GlobalVariableName,
size_t *GlobalVariableSize,
void **GlobalVariablePointerRet) {
return pi2ur::piextGetGlobalVariablePointer(
Device, Program, GlobalVariableName, GlobalVariableSize,
GlobalVariablePointerRet);
}

pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context,
pi_device Device,
pi_usm_mem_properties *Properties, size_t Size,
Expand Down
9 changes: 9 additions & 0 deletions sycl/plugins/hip/pi_hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,15 @@ pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program,
FunctionPointerRet);
}

pi_result piextGetGlobalVariablePointer(pi_device Device, pi_program Program,
const char *GlobalVariableName,
size_t *GlobalVariableSize,
void **GlobalVariablePointerRet) {
return pi2ur::piextGetGlobalVariablePointer(
Device, Program, GlobalVariableName, GlobalVariableSize,
GlobalVariablePointerRet);
}

pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context,
pi_device Device,
pi_usm_mem_properties *Properties, size_t Size,
Expand Down
9 changes: 9 additions & 0 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,15 @@ pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program,
FunctionPointerRet);
}

pi_result piextGetGlobalVariablePointer(pi_device Device, pi_program Program,
const char *GlobalVariableName,
size_t *GlobalVariableSize,
void **GlobalVariablePointerRet) {
return pi2ur::piextGetGlobalVariablePointer(
Device, Program, GlobalVariableName, GlobalVariableSize,
GlobalVariablePointerRet);
}

pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context,
pi_device Device,
pi_usm_mem_properties *Properties, size_t Size,
Expand Down
9 changes: 9 additions & 0 deletions sycl/plugins/native_cpu/pi_native_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,15 @@ pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program,
FunctionPointerRet);
}

pi_result piextGetGlobalVariablePointer(pi_device Device, pi_program Program,
const char *GlobalVariableName,
size_t *GlobalVariableSize,
void **GlobalVariablePointerRet) {
return pi2ur::piextGetGlobalVariablePointer(
Device, Program, GlobalVariableName, GlobalVariableSize,
GlobalVariablePointerRet);
}

pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context,
pi_device Device,
pi_usm_mem_properties *Properties, size_t Size,
Expand Down
9 changes: 9 additions & 0 deletions sycl/plugins/opencl/pi_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,15 @@ pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program,
FunctionPointerRet);
}

pi_result piextGetGlobalVariablePointer(pi_device Device, pi_program Program,
const char *GlobalVariableName,
size_t *GlobalVariableSize,
void **GlobalVariablePointerRet) {
return pi2ur::piextGetGlobalVariablePointer(
Device, Program, GlobalVariableName, GlobalVariableSize,
GlobalVariablePointerRet);
}

pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context,
pi_device Device,
pi_usm_mem_properties *Properties, size_t Size,
Expand Down
14 changes: 7 additions & 7 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
include(FetchContent)

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
# commit ec634ff05b067d7922ec45059dda94665e5dcd9b
# Merge: 418ad535 8714b853
# Author: Piotr Balcer <piotr.balcer@intel.com>
# Date: Thu Mar 14 15:52:52 2024 +0100
# Merge pull request #1438 from PatKamin/disable-fuzztests
# Disable fuzz tests on ubuntu-22.04 runner
set(UNIFIED_RUNTIME_TAG ec634ff05b067d7922ec45059dda94665e5dcd9b)
# commit ed1f8bf618c88eaabea6bde0f6c06fc265f3b49f
# Merge: ca5c3421 69c43b45
# Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
# Date: Tue Mar 19 21:00:20 2024 +0000
# Merge pull request #1326 from hdelan/refactor-guess-local-worksize
# [CUDA][HIP] Fix bug in guess local worksize funcs and improve local worksize guessing in HIP adapter
set(UNIFIED_RUNTIME_TAG ed1f8bf618c88eaabea6bde0f6c06fc265f3b49f)

if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")
Expand Down
16 changes: 16 additions & 0 deletions sycl/plugins/unified_runtime/pi2ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,22 @@ inline pi_result piextGetDeviceFunctionPointer(pi_device Device,
return PI_SUCCESS;
}

inline pi_result piextGetGlobalVariablePointer(
pi_device Device, pi_program Program, const char *GlobalVariableName,
size_t *GlobalVariableSize, void **GlobalVariablePointerRet) {
PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);

auto UrDevice = reinterpret_cast<ur_device_handle_t>(Device);

ur_program_handle_t UrProgram =
reinterpret_cast<ur_program_handle_t>(Program);

HANDLE_ERRORS(urProgramGetGlobalVariablePointer(
UrDevice, UrProgram, GlobalVariableName, GlobalVariableSize,
GlobalVariablePointerRet));
return PI_SUCCESS;
}

// Special version of piKernelSetArg to accept pi_mem.
inline pi_result
piextKernelSetArgMemObj(pi_kernel Kernel, pi_uint32 ArgIndex,
Expand Down
10 changes: 10 additions & 0 deletions sycl/plugins/unified_runtime/pi_unified_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,15 @@ __SYCL_EXPORT pi_result piextGetDeviceFunctionPointer(
FunctionPointerRet);
}

__SYCL_EXPORT pi_result piextGetGlobalVariablePointer(
pi_device Device, pi_program Program, const char *GlobalVariableName,
size_t *GlobalVariableSize, void **GlobalVariablePointerRet) {

return pi2ur::piextGetGlobalVariablePointer(
Device, Program, GlobalVariableName, GlobalVariableSize,
GlobalVariablePointerRet);
}

/// Hint to migrate memory to the device
///
/// @param Queue is the queue to submit to
Expand Down Expand Up @@ -1428,6 +1437,7 @@ __SYCL_EXPORT pi_result piPluginInit(pi_plugin *PluginInit) {
_PI_API(piProgramCompile)
_PI_API(piProgramGetBuildInfo)
_PI_API(piextGetDeviceFunctionPointer)
_PI_API(piextGetGlobalVariablePointer)

_PI_API(piMemBufferCreate)
_PI_API(piMemGetInfo)
Expand Down
1 change: 1 addition & 0 deletions sycl/test/abi/pi_cuda_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ piextEnqueueWriteHostPipe
piextEventCreateWithNativeHandle
piextEventGetNativeHandle
piextGetDeviceFunctionPointer
piextGetGlobalVariablePointer
piextImportExternalSemaphoreOpaqueFD
piextKernelCreateWithNativeHandle
piextKernelGetNativeHandle
Expand Down
1 change: 1 addition & 0 deletions sycl/test/abi/pi_hip_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ piextEnqueueWriteHostPipe
piextEventCreateWithNativeHandle
piextEventGetNativeHandle
piextGetDeviceFunctionPointer
piextGetGlobalVariablePointer
piextImportExternalSemaphoreOpaqueFD
piextKernelCreateWithNativeHandle
piextKernelGetNativeHandle
Expand Down
1 change: 1 addition & 0 deletions sycl/test/abi/pi_level_zero_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ piextEnqueueWriteHostPipe
piextEventCreateWithNativeHandle
piextEventGetNativeHandle
piextGetDeviceFunctionPointer
piextGetGlobalVariablePointer
piextImportExternalSemaphoreOpaqueFD
piextKernelCreateWithNativeHandle
piextKernelGetNativeHandle
Expand Down
1 change: 1 addition & 0 deletions sycl/test/abi/pi_nativecpu_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ piextEnqueueWriteHostPipe
piextEventCreateWithNativeHandle
piextEventGetNativeHandle
piextGetDeviceFunctionPointer
piextGetGlobalVariablePointer
piextImportExternalSemaphoreOpaqueFD
piextKernelCreateWithNativeHandle
piextKernelGetNativeHandle
Expand Down
1 change: 1 addition & 0 deletions sycl/test/abi/pi_opencl_symbol_check.dump
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ piextEnqueueWriteHostPipe
piextEventCreateWithNativeHandle
piextEventGetNativeHandle
piextGetDeviceFunctionPointer
piextGetGlobalVariablePointer
piextImportExternalSemaphoreOpaqueFD
piextKernelCreateWithNativeHandle
piextKernelGetNativeHandle
Expand Down
6 changes: 6 additions & 0 deletions sycl/unittests/helpers/PiMockPlugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ mock_piextGetDeviceFunctionPointer(pi_device device, pi_program program,
return PI_SUCCESS;
}

inline pi_result mock_piextGetGlobalVariablePointer(
pi_device device, pi_program program, const char *global_variable_name,
size_t *global_variable_size, void **global_variable_size_ret) {
return PI_SUCCESS;
}

//
// Context
//
Expand Down