Updated hip_porting_guide.md
Change-Id: Iaf32033597513aa2cbfde267487af35317ac67fe
[ROCm/clr commit: b7dc406ccd]
This commit is contained in:
committato da
Sarbojit Sarkar
parent
cb20d658ff
commit
438e7b78b4
@@ -496,6 +496,22 @@ int main()
|
||||
}
|
||||
```
|
||||
|
||||
## CU_POINTER_ATTRIBUTE_MEMORY_TYPE
|
||||
To get pointer's memory type in HIP/HIP-Clang one should use hipPointerGetAttributes API. First parameter of the API is hipPointerAttribute_t which has 'memoryType' as member variable. 'memoryType' indicates input pointer is allocated on device or host.
|
||||
|
||||
For example:
|
||||
```
|
||||
double * ptr;
|
||||
hipMalloc(reinterpret_cast<void**>(&ptr), sizeof(double));
|
||||
hipPointerAttribute_t attr;
|
||||
hipPointerGetAttributes(&attr, ptr); /*attr.memoryType will have value as hipMemoryTypeDevice*/
|
||||
|
||||
double* ptrHost;
|
||||
hipHostMalloc(&ptrHost, sizeof(double));
|
||||
hipPointerAttribute_t attr;
|
||||
hipPointerGetAttributes(&attr, ptrHost); /*attr.memoryType will have value as hipMemoryTypeHost*/
|
||||
```
|
||||
|
||||
## threadfence_system
|
||||
Threadfence_system makes all device memory writes, all writes to mapped host memory, and all writes to peer memory visible to CPU and other GPU devices.
|
||||
Some implementations can provide this behavior by flushing the GPU L2 cache.
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user