SWDEV-361374 - Adding support for hipPointerSetAttributes

Change-Id: I56710b808854acefca07b3b5898deebee38063e9


[ROCm/clr commit: 0c8c08cf51]
Этот коммит содержится в:
kjayapra-amd authored and Karthik Jayaprakash committed 2023-01-09 12:36:57 -05:00
1 родитель 8de9ca0382
Коммит 5057429e7a
4 files changed
+62 -3

No files matched your search

+35 -2
Просмотреть файл
@@ -2809,8 +2809,9 @@ hipError_t ihipMemset(void* dst, int64_t value, size_t valueSize, size_t sizeByt
size_t offset = 0;
amd::Memory* memObj = getMemoryObject(dst, offset);
auto flags = memObj->getMemFlags();
if (offset == 0 &&
!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_SVM_ATOMICS | CL_MEM_SVM_FINE_GRAIN_BUFFER))) {
if ((memObj->getUserData().sync_mem_ops_)
|| (offset == 0 && !(flags & (CL_MEM_SVM_FINE_GRAIN_BUFFER
| CL_MEM_SVM_ATOMICS | CL_MEM_USE_HOST_PTR)))) {
isAsync = true;
}
}
@@ -3240,6 +3241,25 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void
HIP_RETURN(hipErrorInvalidValue);
}
// ================================================================================================
hipError_t ihipPointerSetAttribute(const void* value, hipPointer_attribute attribute,
hipDeviceptr_t ptr) {
if (attribute != HIP_POINTER_ATTRIBUTE_SYNC_MEMOPS) {
return hipErrorInvalidValue;
}
size_t offset = 0;
amd::Memory* memObj = getMemoryObject(ptr, offset);
if (memObj == nullptr) {
return hipErrorInvalidDevicePointer;
}
memObj->getUserData().sync_mem_ops_
= static_cast<const bool>(*(reinterpret_cast<const unsigned int*>(value)));
return hipSuccess;
}
// ================================================================================================
hipError_t ihipPointerGetAttributes(void* data, hipPointer_attribute attribute,
hipDeviceptr_t ptr) {
@@ -3437,6 +3457,19 @@ hipError_t ihipPointerGetAttributes(void* data, hipPointer_attribute attribute,
}
// ================================================================================================
hipError_t hipPointerSetAttribute(const void* value, hipPointer_attribute attribute,
hipDeviceptr_t ptr) {
HIP_INIT_API(hipPointerSetAttribute, value, attribute, ptr);
if (ptr == nullptr || value == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
HIP_RETURN(ihipPointerSetAttribute(value, attribute, ptr));
}
// ================================================================================================
hipError_t hipPointerGetAttribute(void* data, hipPointer_attribute attribute, hipDeviceptr_t ptr) {
HIP_INIT_API(hipPointerGetAttribute, data, attribute, ptr);