diff --git a/docs/markdown/hip_deprecated_api_list.md b/docs/markdown/hip_deprecated_api_list.md index a96f7f4d3f..dfb202c8ee 100644 --- a/docs/markdown/hip_deprecated_api_list.md +++ b/docs/markdown/hip_deprecated_api_list.md @@ -1,22 +1,22 @@ -# HIP Deprecated API List +# HIP Deprecated APIs ## HIP Context API CUDA supports cuCtx API, the Driver API that defines "Context" and "Devices" as separate entities. Contexts contain a single device, and a device can theoretically have multiple contexts. HIP initially added limited support for these API to facilitate easy porting from existing driver codes. These API are marked as deprecated now since there are better alternate interface (such as hipSetDevice or the stream API) to achieve the required functions. -###hipCtxCreate -###hipCtxDestroy -###hipCtxPopCurrent -###hipCtxPushCurrent -###hipCtxSetCurrent -###hipCtxGetCurrent -###hipCtxGetDevice -###hipCtxGetApiVersion -###hipCtxGetCacheConfig -###hipCtxSetCacheConfig -###hipCtxSetSharedMemConfig -###hipCtxGetSharedMemConfig -###hipCtxSynchronize -###hipCtxGetFlags -###hipCtxEnablePeerAccess -###hipCtxDisablePeerAccess +### hipCtxCreate +### hipCtxDestroy +### hipCtxPopCurrent +### hipCtxPushCurrent +### hipCtxSetCurrent +### hipCtxGetCurrent +### hipCtxGetDevice +### hipCtxGetApiVersion +### hipCtxGetCacheConfig +### hipCtxSetCacheConfig +### hipCtxSetSharedMemConfig +### hipCtxGetSharedMemConfig +### hipCtxSynchronize +### hipCtxGetFlags +### hipCtxEnablePeerAccess +### hipCtxDisablePeerAccess diff --git a/hipify-clang/CMakeLists.txt b/hipify-clang/CMakeLists.txt index 8b3fa7e591..5d9070be28 100644 --- a/hipify-clang/CMakeLists.txt +++ b/hipify-clang/CMakeLists.txt @@ -51,6 +51,10 @@ if(WIN32) target_link_libraries(hipify-clang version) endif() +if ((LLVM_PACKAGE_VERSION VERSION_EQUAL "7") OR (LLVM_PACKAGE_VERSION VERSION_GREATER "7")) + target_link_libraries(hipify-clang clangToolingInclusions) +endif() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") if(MSVC) @@ -95,7 +99,7 @@ if (HIPIFY_CLANG_TESTS) message(STATUS "Please install clang 4.0 or higher.") elseif (CUDA_VERSION VERSION_EQUAL "9.0") message(STATUS "Please install clang 6.0 or higher.") - elseif (CUDA_VERSION VERSION_EQUAL "9.1") + elseif ((CUDA_VERSION VERSION_EQUAL "9.1") OR (CUDA_VERSION VERSION_EQUAL "9.2")) message(STATUS "Please install clang 7.0 or higher.") endif() endif() diff --git a/hipify-clang/README.md b/hipify-clang/README.md index c6f59a0251..e099085ca6 100644 --- a/hipify-clang/README.md +++ b/hipify-clang/README.md @@ -31,7 +31,9 @@ | 4.0.1 | 8.0 | | 5.0.0 | 8.0 | | 5.0.1 | 8.0 | +| 5.0.2 | 8.0 | | 6.0.0 | 9.0 | +| 6.0.1 | 9.0 | In most cases, you can get a suitable version of LLVM+CLANG with your package manager. @@ -80,7 +82,7 @@ To run it: cmake \ -DCMAKE_INSTALL_PREFIX=../dist \ -DLLVM_SOURCE_DIR=../llvm \ - -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_BUILD_TYPE=Release \ -Thost=x64 \ ../llvm @@ -114,9 +116,9 @@ To run it: * Starting with LLVM 6.0.0 path to llvm-lit.py script should be specified by the `LLVM_EXTERNAL_LIT` option: - `-DLLVM_EXTERNAL_LIT=f:/LLVM/6.0.0/build/Debug/bin/llvm-lit.py`, + `-DLLVM_EXTERNAL_LIT=f:/LLVM/6.0.0/build/Release/bin/llvm-lit.py`, - where `f:/LLVM/6.0.0/build/Debug` is LLVM build directory. + where `f:/LLVM/6.0.0/build/Release` is LLVM build directory. 7. Build with the `HIPIFY_CLANG_TESTS` option turned on: -DHIPIFY_CLANG_TESTS=1. 8. `make test-hipify` @@ -124,9 +126,15 @@ To run it: ### Windows -On Windows the following tested configuration is recommended: +On Windows the following configurations are tested: -LLVM 6.0.0 (exact), CUDA 9.0 (exact), cudnn-9.0 (exact), Python 3.6 (min), cmake 3.10 (min), Visual Studio 15.5 2017 (min). +LLVM 6.0.0 - 6.0.1, CUDA 9.0, cudnn-9.0 + +LLVM 5.0.0 - 5.0.2, CUDA 8.0, cudnn-8.0 + +Build system for the above configurations: + +Python 3.6 (min), cmake 3.10 (min), Visual Studio 15.5 2017 (min). Here is an example of building `hipify-clang` with testing support on `Windows 10` by `Visual Studio 15 2017`: @@ -134,13 +142,14 @@ Here is an example of building `hipify-clang` with testing support on `Windows 1 cmake -G "Visual Studio 15 2017 Win64" \ -DHIPIFY_CLANG_TESTS=1 \ - -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=../dist \ -DCMAKE_PREFIX_PATH=f:/LLVM/6.0.0/dist \ -DCUDA_TOOLKIT_ROOT_DIR="c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0" \ -DCUDA_SDK_ROOT_DIR="c:/ProgramData/NVIDIA Corporation/CUDA Samples/v9.0" \ -DCUDA_DNN_ROOT_DIR=f:/CUDNN/cudnn-9.0-windows10-x64-v7.1 \ - -DLLVM_EXTERNAL_LIT=f:/LLVM/6.0.0/build/Debug/bin/llvm-lit.py \ + -DLLVM_EXTERNAL_LIT=f:/LLVM/6.0.0/build/Release/bin/llvm-lit.py \ + -Thost=x64 .. ``` A corresponding successful output: diff --git a/hipify-clang/src/HipifyAction.cpp b/hipify-clang/src/HipifyAction.cpp index 7e5ff4357d..21b16e0699 100644 --- a/hipify-clang/src/HipifyAction.cpp +++ b/hipify-clang/src/HipifyAction.cpp @@ -428,7 +428,11 @@ public: void InclusionDirective(clang::SourceLocation hash_loc, const clang::Token& include_token, StringRef file_name, bool is_angled, clang::CharSourceRange filename_range, const clang::FileEntry* file, StringRef search_path, StringRef relative_path, - const clang::Module* imported) override { + const clang::Module* imported +#if LLVM_VERSION_MAJOR > 6 + , clang::SrcMgr::CharacteristicKind FileType +#endif + ) override { hipifyAction.InclusionDirective(hash_loc, include_token, file_name, is_angled, filename_range, file, search_path, relative_path, imported); } diff --git a/hipify-clang/src/LLVMCompat.h b/hipify-clang/src/LLVMCompat.h index 3e2fe1aebb..72b6832012 100644 --- a/hipify-clang/src/LLVMCompat.h +++ b/hipify-clang/src/LLVMCompat.h @@ -23,6 +23,10 @@ namespace llcompat { #define GET_NUM_ARGS() getNumArgs() #endif +#if LLVM_VERSION_MAJOR < 7 + #define LLVM_DEBUG(X) DEBUG(X) +#endif + void PrintStackTraceOnErrorSignal(); /** diff --git a/hipify-clang/src/main.cpp b/hipify-clang/src/main.cpp index ccf627b147..e420ab0681 100644 --- a/hipify-clang/src/main.cpp +++ b/hipify-clang/src/main.cpp @@ -132,7 +132,7 @@ int main(int argc, const char **argv) { // Hipify _all_ the things! if (Tool.runAndSave(&actionFactory)) { - DEBUG(llvm::dbgs() << "Skipped some replacements.\n"); + LLVM_DEBUG(llvm::dbgs() << "Skipped some replacements.\n"); } // Either move the tmpfile to the output, or remove it. diff --git a/include/hip/hcc_detail/hip_runtime_api.h b/include/hip/hcc_detail/hip_runtime_api.h index 0a80a583c7..573ae39af9 100644 --- a/include/hip/hcc_detail/hip_runtime_api.h +++ b/include/hip/hcc_detail/hip_runtime_api.h @@ -2621,6 +2621,13 @@ hipError_t hipBindTextureToArray(struct texture& tex, hipArray return ihipBindTextureToArrayImpl(dim, readMode, array, desc, &tex); } +template +inline static hipError_t hipBindTextureToArray(struct texture *tex, + hipArray_const_t array, + const struct hipChannelFormatDesc* desc) { + return ihipBindTextureToArrayImpl(dim, readMode, array, *desc, tex); +} + // C API hipError_t hipBindTextureToMipmappedArray(const textureReference* tex, hipMipmappedArray_const_t mipmappedArray, diff --git a/include/hip/nvcc_detail/hip_runtime_api.h b/include/hip/nvcc_detail/hip_runtime_api.h index 3b8a3661f7..55a3794846 100644 --- a/include/hip/nvcc_detail/hip_runtime_api.h +++ b/include/hip/nvcc_detail/hip_runtime_api.h @@ -163,6 +163,7 @@ typedef cudaSurfaceObject_t hipSurfaceObject_t; #define hipTextureType1D cudaTextureType1D #define hipTextureType1DLayered cudaTextureType1DLayered #define hipTextureType2D cudaTextureType2D +#define hipTextureType2DLayered cudaTextureType2DLayered #define hipTextureType3D cudaTextureType3D #define hipDeviceMapHost cudaDeviceMapHost @@ -1168,20 +1169,20 @@ inline static hipError_t hipOccupancyMaxPotentialBlockSize(int* minGridSize, int return hipCUDAErrorTohipError(cerror); } -template +template inline static hipError_t hipBindTexture(size_t* offset, const struct texture& tex, const void* devPtr, size_t size = UINT_MAX) { return hipCUDAErrorTohipError(cudaBindTexture(offset, tex, devPtr, size)); } -template +template inline static hipError_t hipBindTexture(size_t* offset, struct texture& tex, const void* devPtr, const struct hipChannelFormatDesc& desc, size_t size = UINT_MAX) { return hipCUDAErrorTohipError(cudaBindTexture(offset, tex, devPtr, desc, size)); } -template +template inline static hipError_t hipUnbindTexture(struct texture* tex) { return hipCUDAErrorTohipError(cudaUnbindTexture(tex)); } @@ -1198,7 +1199,14 @@ inline static hipError_t hipBindTextureToArray(struct texture& return hipCUDAErrorTohipError(cudaBindTextureToArray(tex, array, desc)); } -template +template +inline static hipError_t hipBindTextureToArray(struct texture *tex, + hipArray_const_t array, + const struct hipChannelFormatDesc* desc) { + return hipCUDAErrorTohipError(cudaBindTextureToArray(tex, array, desc)); +} + +template inline static hipError_t hipBindTextureToArray(struct texture& tex, hipArray_const_t array) { return hipCUDAErrorTohipError(cudaBindTextureToArray(tex, array)); @@ -1239,6 +1247,16 @@ inline static hipError_t hipGetTextureObjectResourceDesc(hipResourceDesc* pResDe hipTextureObject_t textureObject) { return hipCUDAErrorTohipError(cudaGetTextureObjectResourceDesc( pResDesc, textureObject)); } + +inline static hipError_t hipGetTextureAlignmentOffset(size_t* offset, const textureReference* texref) +{ + return hipCUDAErrorTohipError(cudaGetTextureAlignmentOffset(offset,texref)); +} + +inline static hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_const_t array) +{ + return hipCUDAErrorTohipError(cudaGetChannelDesc(desc,array)); +} #endif //__CUDACC__ #endif // HIP_INCLUDE_HIP_NVCC_DETAIL_HIP_RUNTIME_API_H diff --git a/src/code_object_bundle.cpp b/src/code_object_bundle.cpp index ede7090a52..91258f0c75 100644 --- a/src/code_object_bundle.cpp +++ b/src/code_object_bundle.cpp @@ -38,7 +38,7 @@ std::string isa_name(std::string triple) hsa_isa_from_name(triple.c_str(), &tmp) != HSA_STATUS_SUCCESS}; if (is_old_rocr) { - auto tmp{triple.substr(triple.rfind('x') + 1)}; + std::string tmp{triple.substr(triple.rfind('x') + 1)}; triple.replace(0, std::string::npos, "AMD:AMDGPU"); for (auto&& x : tmp) { @@ -51,7 +51,7 @@ std::string isa_name(std::string triple) } hsa_isa_t hip_impl::triple_to_hsa_isa(const std::string& triple) { - const auto isa{isa_name(std::move(triple))}; + const std::string isa{isa_name(std::move(triple))}; if (isa.empty()) return hsa_isa_t({}); diff --git a/src/hip_memory.cpp b/src/hip_memory.cpp index 787e49683b..d6c04ae98c 100644 --- a/src/hip_memory.cpp +++ b/src/hip_memory.cpp @@ -1680,12 +1680,9 @@ hipError_t hipMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t sp actualDest = pinnedPtr; } } -#if 0 if((width == dpitch) && (width == spitch)) { hip_internal::memcpyAsync(dst, src, width*height, kind, stream); - } else -#endif - { + } else { try { if(!isLocked){ for (int i = 0; i < height; ++i) diff --git a/src/hip_texture.cpp b/src/hip_texture.cpp index 24c6eef3af..d6caf853de 100644 --- a/src/hip_texture.cpp +++ b/src/hip_texture.cpp @@ -389,7 +389,8 @@ hipError_t ihipBindTextureImpl(int dim, enum hipTextureReadMode readMode, size_t enum hipTextureFilterMode filterMode = tex->filterMode; int normalizedCoords = tex->normalized; hipTextureObject_t& textureObject = tex->textureObject; - *offset = 0; + if(offset != nullptr) + *offset = 0; auto ctx = ihipGetTlsDefaultCtx(); if (ctx) { hc::accelerator acc = ctx->getDevice()->_acc; @@ -459,7 +460,8 @@ hipError_t ihipBindTexture2DImpl(int dim, enum hipTextureReadMode readMode, size enum hipTextureFilterMode filterMode = tex->filterMode; int normalizedCoords = tex->normalized; hipTextureObject_t& textureObject = tex->textureObject; - *offset = 0; + if(offset != nullptr) + *offset = 0; auto ctx = ihipGetTlsDefaultCtx(); if (ctx) { hc::accelerator acc = ctx->getDevice()->_acc; diff --git a/tests/src/deviceLib/hip_mbcnt.cpp b/tests/src/deviceLib/hip_mbcnt.cpp index 0dd7169f51..9fdf36a1d3 100644 --- a/tests/src/deviceLib/hip_mbcnt.cpp +++ b/tests/src/deviceLib/hip_mbcnt.cpp @@ -88,7 +88,7 @@ int main() { for (unsigned int i = 0; i < num_threads; i++) { unsigned int this_lane_id = i % wave_size; unsigned int this_mbcnt_lo = this_lane_id >= 32 ? 32 : this_lane_id; - unsigned int this_mbcnt_hi = this_lane_id < 32 ? 0 : (this_lane_id - 22); + unsigned int this_mbcnt_hi = this_lane_id < 32 ? 0 : (this_lane_id - 32); if (host_mbcnt_lo[i] != this_mbcnt_lo) mbcnt_lo_errors++;