Doc update. Describe memcpytosymbol, threadfence_system workarounds

这个提交包含在:
Ben Sander
2016-08-29 08:04:08 -05:00
父节点 9e21549139
当前提交 99727231a3
修改 2 个文件,包含 50 行新增7 行删除
+7 -4
查看文件
@@ -32,10 +32,12 @@
HIP provides the following:
- Devices (hipSetDevice(), hipGetDeviceProperties(), etc.)
- Memory management (hipMalloc(), hipMemcpy(), hipFree(), etc.)
- Streams (hipStreamCreate(), etc.)
- Streams (hipStreamCreate(),hipStreamSynchronize(), hipStreamWaitEvent(), etc.)
- Events (hipEventRecord(), hipEventElapsedTime(), etc.)
- Kernel launching (hipLaunchKernel is a standard C/C++ function that replaces <<< >>>)
- HIP Module API to control when adn how code is loaded.
- CUDA-style kernel coordinate functions (threadIdx, blockIdx, blockDim, gridDim)
- Cross-lane instructions including shfl, ballot, any, all
- Most device-side math built-ins
- Error reporting (hipGetLastError(), hipGetErrorString())
@@ -53,6 +55,7 @@ At a high-level, the following features are not supported:
- CUDA array, mipmappedArray and pitched memory
- MemcpyToSymbol functions
- Queue priority controls
See the [API Support Table](CUDA_Runtime_API_functions_supported_by_HIP.md) for more detailed information.
@@ -60,10 +63,10 @@ See the [API Support Table](CUDA_Runtime_API_functions_supported_by_HIP.md) for
- Device-side dynamic memory allocations (malloc, free, new, delete) (CUDA 4.0)
- Virtual functions, indirect functions and try/catch (CUDA 4.0)
- `__prof_trigger`
- PTX assembly (CUDA 4.0)
- PTX assembly (CUDA 4.0). HCC supports inline GCN assembly.
- Several kernel features are under development. See the [HIP Kernel Language](hip_kernel_language.md) for more information. These include:
- printf
- assert__
- assert
- `__restrict__`
- `__launch_bounds__`
- `__threadfence*_`, `__syncthreads*`
@@ -74,7 +77,7 @@ See the [API Support Table](CUDA_Runtime_API_functions_supported_by_HIP.md) for
### Is HIP a drop-in replacement for CUDA?
No. HIP provides porting tools which do most of the work do convert CUDA code into portable C++ code that uses the HIP APIs.
Most developers will port their code from CUDA to HIP and then maintain the HIP version.
HIP code provides the same performance as coding in native CUDA, plus the benefit that the code can also run on AMD platforms.
HIP code provides the same performance as native CUDA code, plus the benefits of running on AMD platforms.
### What specific version of CUDA does HIP support?
HIP APIs and features do not map to a specific CUDA version. HIP provides a strong subset of functionality provided in CUDA, and the hipify tools can
+43 -3
查看文件
@@ -395,13 +395,53 @@ For new projects or ports which can be re-factored, we recommend the use of the
This indicates that the code is standard C++ code, but also provides a unique indication for make tools to
run hipcc when appropriate.
### Workarounds
## Workarounds
#### warpSize
### warpSize
Code should not assume a warp size of 32 or 64. See [Warp Cross-Lane Functions](hip_kernel_language.md#warp-cross-lane-functions) for information on how to write portable wave-aware code.
## memcpyToSymbol
#### Textures and Cache Control
HIP support for hipMemCpyToSymbol is under-development. This feature allows a kernel
to define a device-side data symbol which can be accessed on the host side. The symbol
can be in __constant or device space. As a workaround, programs can pass the symbol
as an argument to the kernel, and use standard hipMemcpy routines to initialize it.
For example:
Device Code:
```
// Cuda Device Code
__constant__ float Array[1024];
__global__ void Inc(float *Out){
Int tx = hipThreadIdx_x;
Out[tx] = Array[tx] + 1;
}
// HIP Device Code
__global__ void Inc(hipLaunchParm lp, float *Array, float *Out){
Int tx = hipThreadIdx_x;
Out[tx] = Array[tx] + 1;
}
```
Host Code:
```
// CUDA Host Code
cudaMemcpyToSymbol(Array, hostArray, sizeofArray);
// HIP Host Code
hipMemcpy(Array, hostArray, sizeofArray);
```
## 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.
HIP/HCC does not provide this functionality. As a workaround, users can set the environment variable `HSA_DISABLE_CACHE=1` to
disable the GPU L2 cache. This will affect all accesses and for all kernels and so may have
a performance impact.
### Textures and Cache Control
>Texture support is under-development and not yet supported by HIP.