SWDEV-546328 - API definitions for hipMemsetD2D8/D16/D32 (#789)
Co-authored-by: Rahul Manocha <rmanocha@amd.com>
[ROCm/clr commit: 5f86622adc]
This commit is contained in:
@@ -493,3 +493,9 @@ hipLinkDestroy
|
||||
hipLaunchKernelExC
|
||||
hipDrvLaunchKernelEx
|
||||
hipModuleGetFunctionCount
|
||||
hipMemsetD2D8
|
||||
hipMemsetD2D8Async
|
||||
hipMemsetD2D16
|
||||
hipMemsetD2D16Async
|
||||
hipMemsetD2D32
|
||||
hipMemsetD2D32Async
|
||||
|
||||
@@ -831,6 +831,18 @@ hipError_t hipDrvLaunchKernelEx(const HIP_LAUNCH_CONFIG* config, hipFunction_t f
|
||||
hipError_t hipMemGetHandleForAddressRange(void* handle, hipDeviceptr_t dptr, size_t size,
|
||||
hipMemRangeHandleType handleType,
|
||||
unsigned long long flags);
|
||||
hipError_t hipMemsetD2D8(hipDeviceptr_t dst, size_t dstPitch, unsigned char value, size_t width,
|
||||
size_t height);
|
||||
hipError_t hipMemsetD2D8Async(hipDeviceptr_t dst, size_t dstPitch, unsigned char value, size_t width,
|
||||
size_t height, hipStream_t stream);
|
||||
hipError_t hipMemsetD2D16(hipDeviceptr_t dst, size_t dstPitch, unsigned short value, size_t width,
|
||||
size_t height);
|
||||
hipError_t hipMemsetD2D16Async(hipDeviceptr_t dst, size_t dstPitch, unsigned short value,
|
||||
size_t width, size_t height, hipStream_t stream);
|
||||
hipError_t hipMemsetD2D32(hipDeviceptr_t dst, size_t dstPitch, unsigned int value, size_t width,
|
||||
size_t height);
|
||||
hipError_t hipMemsetD2D32Async(hipDeviceptr_t dst, size_t dstPitch, unsigned int value,
|
||||
size_t width, size_t height, hipStream_t stream);
|
||||
|
||||
} // namespace hip
|
||||
|
||||
@@ -1348,6 +1360,12 @@ void UpdateDispatchTable(HipDispatchTable* ptrDispatchTable) {
|
||||
ptrDispatchTable->hipLaunchKernelExC_fn = hip::hipLaunchKernelExC;
|
||||
ptrDispatchTable->hipDrvLaunchKernelEx_fn = hip::hipDrvLaunchKernelEx;
|
||||
ptrDispatchTable->hipMemGetHandleForAddressRange_fn = hip::hipMemGetHandleForAddressRange;
|
||||
ptrDispatchTable->hipMemsetD2D8_fn = hip::hipMemsetD2D8;
|
||||
ptrDispatchTable->hipMemsetD2D8Async_fn = hip::hipMemsetD2D8Async;
|
||||
ptrDispatchTable->hipMemsetD2D16_fn = hip::hipMemsetD2D16;
|
||||
ptrDispatchTable->hipMemsetD2D16Async_fn = hip::hipMemsetD2D16Async;
|
||||
ptrDispatchTable->hipMemsetD2D32_fn = hip::hipMemsetD2D32;
|
||||
ptrDispatchTable->hipMemsetD2D32Async_fn = hip::hipMemsetD2D32Async;
|
||||
}
|
||||
|
||||
#if HIP_ROCPROFILER_REGISTER > 0
|
||||
@@ -1993,13 +2011,20 @@ HIP_ENFORCE_ABI(HipDispatchTable, hipDrvLaunchKernelEx_fn, 475);
|
||||
HIP_ENFORCE_ABI(HipDispatchTable, hipMemGetHandleForAddressRange_fn, 476);
|
||||
// HIP_RUNTIME_API_TABLE_STEP_VERSION == 13
|
||||
HIP_ENFORCE_ABI(HipDispatchTable, hipModuleGetFunctionCount_fn, 477);
|
||||
HIP_ENFORCE_ABI(HipDispatchTable, hipMemsetD2D8_fn, 478);
|
||||
HIP_ENFORCE_ABI(HipDispatchTable, hipMemsetD2D8Async_fn, 479);
|
||||
HIP_ENFORCE_ABI(HipDispatchTable, hipMemsetD2D16_fn, 480);
|
||||
HIP_ENFORCE_ABI(HipDispatchTable, hipMemsetD2D16Async_fn, 481);
|
||||
HIP_ENFORCE_ABI(HipDispatchTable, hipMemsetD2D32_fn, 482);
|
||||
HIP_ENFORCE_ABI(HipDispatchTable, hipMemsetD2D32Async_fn, 483);
|
||||
|
||||
// if HIP_ENFORCE_ABI entries are added for each new function pointer in the table, the number below
|
||||
// will be +1 of the number in the last HIP_ENFORCE_ABI line. E.g.:
|
||||
//
|
||||
// HIP_ENFORCE_ABI(<table>, <functor>, 8)
|
||||
//
|
||||
// HIP_ENFORCE_ABI_VERSIONING(<table>, 9) <- 8 + 1 = 9
|
||||
HIP_ENFORCE_ABI_VERSIONING(HipDispatchTable, 478)
|
||||
HIP_ENFORCE_ABI_VERSIONING(HipDispatchTable, 484)
|
||||
|
||||
static_assert(HIP_RUNTIME_API_TABLE_MAJOR_VERSION == 0 && HIP_RUNTIME_API_TABLE_STEP_VERSION == 14,
|
||||
"If you get this error, add new HIP_ENFORCE_ABI(...) code for the new function "
|
||||
|
||||
@@ -609,6 +609,12 @@ local:
|
||||
hip_7.1 {
|
||||
global:
|
||||
hipModuleGetFunctionCount;
|
||||
hipMemsetD2D8;
|
||||
hipMemsetD2D8Async;
|
||||
hipMemsetD2D16;
|
||||
hipMemsetD2D16Async;
|
||||
hipMemsetD2D32;
|
||||
hipMemsetD2D32Async;
|
||||
local:
|
||||
*;
|
||||
} hip_6.5;
|
||||
} hip_6.5;
|
||||
@@ -3117,7 +3117,7 @@ hipError_t ihipMemset3DCommand(std::vector<amd::Command*> &commands, hipPitchedP
|
||||
|
||||
|
||||
hipError_t ihipMemset3D(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent,
|
||||
hipStream_t stream, bool isAsync = false) {
|
||||
hipStream_t stream, bool isAsync = false, size_t elementSize = 1) {
|
||||
auto sizeBytes = extent.width * extent.height * extent.depth;
|
||||
|
||||
if (sizeBytes == 0) {
|
||||
@@ -3142,7 +3142,7 @@ hipError_t ihipMemset3D(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent
|
||||
}
|
||||
hip::Stream* hip_stream = hip::getStream(stream);
|
||||
std::vector<amd::Command*> commands;
|
||||
status = ihipMemset3DCommand(commands, pitchedDevPtr, value, extent, hip_stream);
|
||||
status = ihipMemset3DCommand(commands, pitchedDevPtr, value, extent, hip_stream, elementSize);
|
||||
if (status != hipSuccess) {
|
||||
return status;
|
||||
}
|
||||
@@ -3157,9 +3157,10 @@ hipError_t ihipMemset3D(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent
|
||||
}
|
||||
|
||||
hipError_t hipMemset2D_common(void* dst, size_t pitch, int value, size_t width,
|
||||
size_t height, hipStream_t stream=nullptr) {
|
||||
size_t height, hipStream_t stream=nullptr, size_t elementSize = 1) {
|
||||
CHECK_STREAM_CAPTURING();
|
||||
return ihipMemset3D({dst, pitch, width, height}, value, {width, height, 1}, stream);
|
||||
return ihipMemset3D({dst, pitch, width, height}, value, {width, height, 1}, stream, false,
|
||||
elementSize);
|
||||
}
|
||||
|
||||
hipError_t hipMemset2D_spt(void* dst, size_t pitch, int value, size_t width, size_t height) {
|
||||
@@ -3173,11 +3174,11 @@ hipError_t hipMemset2D(void* dst, size_t pitch, int value, size_t width, size_t
|
||||
HIP_RETURN(hipMemset2D_common(dst, pitch, value, width, height));
|
||||
}
|
||||
|
||||
hipError_t hipMemset2DAsync_common(void* dst, size_t pitch, int value,
|
||||
size_t width, size_t height, hipStream_t stream) {
|
||||
hipError_t hipMemset2DAsync_common(void* dst, size_t pitch, int value, size_t width, size_t height,
|
||||
hipStream_t stream, size_t elementSize = 1) {
|
||||
STREAM_CAPTURE(hipMemset2DAsync, stream, dst, pitch, value, width, height);
|
||||
|
||||
return ihipMemset3D({dst, pitch, width, height}, value, {width, height, 1}, stream, true);
|
||||
return ihipMemset3D({dst, pitch, width, height}, value, {width, height, 1}, stream, true,
|
||||
elementSize);
|
||||
}
|
||||
|
||||
hipError_t hipMemset2DAsync(void* dst, size_t pitch, int value,
|
||||
@@ -3193,6 +3194,48 @@ hipError_t hipMemset2DAsync_spt(void* dst, size_t pitch, int value,
|
||||
HIP_RETURN(hipMemset2DAsync_common(dst, pitch, value, width, height, stream));
|
||||
}
|
||||
|
||||
hipError_t hipMemsetD2D8(hipDeviceptr_t dst, size_t dstPitch, unsigned char value, size_t width,
|
||||
size_t height) {
|
||||
HIP_INIT_API(hipMemsetD2D8, dst, dstPitch, value, width, height);
|
||||
HIP_RETURN(hipMemset2D_common(dst, dstPitch, value, width, height, nullptr,
|
||||
sizeof(unsigned char)));
|
||||
}
|
||||
|
||||
hipError_t hipMemsetD2D8Async(hipDeviceptr_t dst, size_t dstPitch, unsigned char value, size_t width,
|
||||
size_t height, hipStream_t stream) {
|
||||
HIP_INIT_API(hipMemsetD2D8Async, dst, dstPitch, value, width, height, stream);
|
||||
HIP_RETURN(hipMemset2DAsync_common(dst, dstPitch, value, width, height, stream,
|
||||
sizeof(unsigned char)));
|
||||
}
|
||||
|
||||
hipError_t hipMemsetD2D16(hipDeviceptr_t dst, size_t dstPitch, unsigned short value, size_t width,
|
||||
size_t height) {
|
||||
HIP_INIT_API(hipMemsetD2D16, dst, dstPitch, value, width, height);
|
||||
HIP_RETURN(hipMemset2D_common(dst, dstPitch, value, width, height, nullptr,
|
||||
sizeof(unsigned short)));
|
||||
}
|
||||
|
||||
hipError_t hipMemsetD2D16Async(hipDeviceptr_t dst, size_t dstPitch, unsigned short value,
|
||||
size_t width, size_t height, hipStream_t stream) {
|
||||
HIP_INIT_API(hipMemsetD2D16Async, dst, dstPitch, value, width, height, stream);
|
||||
HIP_RETURN(hipMemset2DAsync_common(dst, dstPitch, value, width, height, stream,
|
||||
sizeof(unsigned short)));
|
||||
}
|
||||
|
||||
hipError_t hipMemsetD2D32(hipDeviceptr_t dst, size_t dstPitch, unsigned int value, size_t width,
|
||||
size_t height) {
|
||||
HIP_INIT_API(hipMemsetD2D32, dst, dstPitch, value, width, height);
|
||||
HIP_RETURN(hipMemset2D_common(dst, dstPitch, value, width, height, nullptr,
|
||||
sizeof(unsigned int)));
|
||||
}
|
||||
|
||||
hipError_t hipMemsetD2D32Async(hipDeviceptr_t dst, size_t dstPitch, unsigned int value,
|
||||
size_t width, size_t height, hipStream_t stream) {
|
||||
HIP_INIT_API(hipMemsetD2D32Async, dst, dstPitch, value, width, height, stream);
|
||||
HIP_RETURN(hipMemset2DAsync_common(dst, dstPitch, value, width, height, stream,
|
||||
sizeof(unsigned int)));
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
hipError_t hipMemset3D_common(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent,
|
||||
hipStream_t stream=nullptr) {
|
||||
|
||||
@@ -1888,4 +1888,31 @@ hipError_t hipMemGetHandleForAddressRange(void* handle, hipDeviceptr_t dptr, siz
|
||||
unsigned long long flags) {
|
||||
return hip::GetHipDispatchTable()->hipMemGetHandleForAddressRange_fn(handle, dptr, size,
|
||||
handleType, flags);
|
||||
}
|
||||
hipError_t hipMemsetD2D8(hipDeviceptr_t dst, size_t dstPitch, unsigned char value, size_t width,
|
||||
size_t height) {
|
||||
return hip::GetHipDispatchTable()->hipMemsetD2D8_fn(dst, dstPitch, value, width, height);
|
||||
}
|
||||
hipError_t hipMemsetD2D8Async(hipDeviceptr_t dst, size_t dstPitch, unsigned char value, size_t width,
|
||||
size_t height, hipStream_t stream) {
|
||||
return hip::GetHipDispatchTable()->hipMemsetD2D8Async_fn(dst, dstPitch, value, width, height,
|
||||
stream);
|
||||
}
|
||||
hipError_t hipMemsetD2D16(hipDeviceptr_t dst, size_t dstPitch, unsigned short value, size_t width,
|
||||
size_t height) {
|
||||
return hip::GetHipDispatchTable()->hipMemsetD2D16_fn(dst, dstPitch, value, width, height);
|
||||
}
|
||||
hipError_t hipMemsetD2D16Async(hipDeviceptr_t dst, size_t dstPitch, unsigned short value, size_t width,
|
||||
size_t height, hipStream_t stream) {
|
||||
return hip::GetHipDispatchTable()->hipMemsetD2D16Async_fn(dst, dstPitch, value, width, height,
|
||||
stream);
|
||||
}
|
||||
hipError_t hipMemsetD2D32(hipDeviceptr_t dst, size_t dstPitch, unsigned int value, size_t width,
|
||||
size_t height) {
|
||||
return hip::GetHipDispatchTable()->hipMemsetD2D32_fn(dst, dstPitch, value, width, height);
|
||||
}
|
||||
hipError_t hipMemsetD2D32Async(hipDeviceptr_t dst, size_t dstPitch, unsigned int value, size_t width,
|
||||
size_t height, hipStream_t stream) {
|
||||
return hip::GetHipDispatchTable()->hipMemsetD2D32Async_fn(dst, dstPitch, value, width, height,
|
||||
stream);
|
||||
}
|
||||
Fai riferimento in un nuovo problema
Block a user