From 09fe3cc7d4fd6730403f77e579177794bb88fa8d Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Wed, 10 Feb 2016 09:29:29 -0600 Subject: [PATCH 01/82] Initial commit --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..91165785bb --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# HIPIFY +The CLANG-based HIPIFY tool - translates CUDA to HIP From 5f224280ce265a0f1fa92c288da227673f960217 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Wed, 10 Feb 2016 20:20:11 +0300 Subject: [PATCH 02/82] Initial version of CLANG based HIPIFY tool for CUDA -> HIP sources conversion --- CMakeLists.txt | 42 ++++ README.md | 10 +- src/Cuda2Hip.cpp | 526 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 577 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt create mode 100644 src/Cuda2Hip.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..6d727c70be --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 2.8.8) + +project(hipify) + +find_package(LLVM REQUIRED PATHS ${LLVM_DIR} NO_DEFAULT_PATH) + +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") + +include_directories(${LLVM_INCLUDE_DIRS}) +link_directories(${LLVM_LIBRARY_DIRS}) +add_definitions(${LLVM_DEFINITIONS}) + +# Now build our tools +add_executable(hipify src/Cuda2Hip.cpp) + +# Link against LLVM and CLANG tools libraries +target_link_libraries(hipify + clangASTMatchers + clangFrontend + clangTooling + clangParse + clangSerialization + clangSema + clangEdit + clangLex + clangAnalysis + clangDriver + clangAST + clangToolingCore + clangRewrite + clangBasic + LLVMSupport + LLVMMCParser + LLVMMC + LLVMBitReader + LLVMOption + LLVMCore) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -fno-rtti -fvisibility-inlines-hidden") diff --git a/README.md b/README.md index 91165785bb..a813325e65 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,10 @@ # HIPIFY -The CLANG-based HIPIFY tool - translates CUDA to HIP +The CLANG-based HIPIFY tool - translates CUDA to [HIP](https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/blob/master/README.md) + +# How to Build +- Get LLVM and CLANG sources and build CLANG, then install it to a **LLVM_INSTALL_PATH** folder +- make build dir for hipify and run the folloing commands there: +``` +> cmake -DLLVM_DIR="LLVM_INSTALL_PATH" path_to_hipify_src +> make +``` diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp new file mode 100644 index 0000000000..c4c8f58810 --- /dev/null +++ b/src/Cuda2Hip.cpp @@ -0,0 +1,526 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +/** + * @file Cuda2Hip.cpp + * + * This file is compiled and linked into clang based hipify tool. + */ +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/Basic/SourceManager.h" +#include "clang/Frontend/FrontendActions.h" +#include "clang/Lex/Lexer.h" +#include "clang/Tooling/CommonOptionsParser.h" +#include "clang/Tooling/Refactoring.h" +#include "clang/Tooling/Tooling.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/Signals.h" +#include "llvm/Support/Debug.h" +#include "clang/Frontend/TextDiagnosticPrinter.h" +#include "clang/Rewrite/Core/Rewriter.h" +#include "clang/Lex/MacroInfo.h" +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Lex/Preprocessor.h" +#include "clang/Lex/PPCallbacks.h" + +#include +#include + +using namespace clang; +using namespace clang::ast_matchers; +using namespace clang::tooling; +using namespace llvm; + +#define DEBUG_TYPE "cuda2hip" + +namespace { + struct hipName { + hipName() { + // defines + cuda2hipRename["__CUDACC__"] = "__HIPCC__"; + + // includes + cuda2hipRename["cuda_runtime.h"] = "hip_runtime.h"; + cuda2hipRename["cuda_runtime_api.h"] = "hip_runtime_api.h"; + + // Error codes and return types: + cuda2hipRename["cudaError_t"] = "hipError_t"; + cuda2hipRename["cudaError"] = "hipError_t"; + cuda2hipRename["cudaSuccess"] = "hipSuccess"; + + cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; + cuda2hipRename["cudaErrorMemoryAllocation"] = "hipErrorMemoryAllocation"; + cuda2hipRename["cudaErrorMemoryFree"] = "hipErrorMemoryFree"; + cuda2hipRename["cudaErrorUnknownSymbol"] = "hipErrorUnknownSymbol"; + cuda2hipRename["cudaErrorOutOfResources"] = "hipErrorOutOfResources"; + cuda2hipRename["cudaErrorInvalidValue"] = "hipErrorInvalidValue"; + cuda2hipRename["cudaErrorInvalidResourceHandle"] = "hipErrorInvalidResourceHandle"; + cuda2hipRename["cudaErrorInvalidDevice"] = "hipErrorInvalidDevice"; + cuda2hipRename["cudaErrorNoDevice"] = "hipErrorNoDevice"; + cuda2hipRename["cudaErrorNotReady"] = "hipErrorNotReady"; + cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; + + // error APIs: + cuda2hipRename["cudaGetLastError"] = "hipGetLastError"; + cuda2hipRename["cudaPeekAtLastError"] = "hipPeekAtLastError"; + cuda2hipRename["cudaGetErrorName"] = "hipGetErrorName"; + cuda2hipRename["cudaGetErrorString"] = "hipGetErrorString"; + + // Memcpy + cuda2hipRename["cudaMemcpy"] = "hipMemcpy"; + cuda2hipRename["cudaMemcpyHostToHost"] = "hipMemcpyHostToHost"; + cuda2hipRename["cudaMemcpyHostToDevice"] = "hipMemcpyHostToDevice"; + cuda2hipRename["cudaMemcpyDeviceToHost"] = "hipMemcpyDeviceToHost"; + cuda2hipRename["cudaMemcpyDeviceToDevice"] = "hipMemcpyDeviceToDevice"; + cuda2hipRename["cudaMemcpyDefault"] = "hipMemcpyDefault"; + cuda2hipRename["cudaMemcpyToSymbol"] = "hipMemcpyToSymbol"; + cuda2hipRename["cudaMemset"] = "hipMemset"; + cuda2hipRename["cudaMemsetAsync"] = "hipMemsetAsync"; + cuda2hipRename["cudaMemcpyAsync"] = "hipMemcpyAsync"; + cuda2hipRename["cudaMemGetInfo"] = "hipMemGetInfo"; + cuda2hipRename["cudaMemcpyKind"] = "hipMemcpyKind"; + + // Memory management : + cuda2hipRename["cudaMalloc"] = "hipMalloc"; + cuda2hipRename["cudaMallocHost"] = "hipMallocHost"; + cuda2hipRename["cudaFree"] = "hipFree"; + cuda2hipRename["cudaFreeHost"] = "hipFreeHost"; + + // Coordinate Indexing and Dimensions: + cuda2hipRename["threadIdx.x"] = "hipThreadIdx_x"; + cuda2hipRename["threadIdx.y"] = "hipThreadIdx_y"; + cuda2hipRename["threadIdx.z"] = "hipThreadIdx_z"; + + cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; + cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; + cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; + + cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; + cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; + cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; + + cuda2hipRename["gridDim.x"] = "hipGridDim_x"; + cuda2hipRename["gridDim.y"] = "hipGridDim_y"; + cuda2hipRename["gridDim.z"] = "hipGridDim_z"; + + cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; + cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; + cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; + + cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; + cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; + cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; + + cuda2hipRename["gridDim.x"] = "hipGridDim_x"; + cuda2hipRename["gridDim.y"] = "hipGridDim_y"; + cuda2hipRename["gridDim.z"] = "hipGridDim_z"; + + + cuda2hipRename["warpSize"] = "hipWarpSize"; + + // Events + cuda2hipRename["cudaEvent_t"] = "hipEvent_t"; + cuda2hipRename["cudaEventCreate"] = "hipEventCreate"; + cuda2hipRename["cudaEventCreateWithFlags"] = "hipEventCreateWithFlags"; + cuda2hipRename["cudaEventDestroy"] = "hipEventDestroy"; + cuda2hipRename["cudaEventRecord"] = "hipEventRecord"; + cuda2hipRename["cudaEventElapsedTime"] = "hipEventElapsedTime"; + cuda2hipRename["cudaEventSynchronize"] = "hipEventSynchronize"; + + // Streams + cuda2hipRename["cudaStream_t"] = "hipStream_t"; + cuda2hipRename["cudaStreamCreate"] = "hipStreamCreate"; + cuda2hipRename["cudaStreamCreateWithFlags"] = "hipStreamCreateWithFlags"; + cuda2hipRename["cudaStreamDestroy"] = "hipStreamDestroy"; + cuda2hipRename["cudaStreamWaitEvent"] = "hipStreamWaitEven"; + cuda2hipRename["cudaStreamSynchronize"] = "hipStreamSynchronize"; + cuda2hipRename["cudaStreamDefault"] = "hipStreamDefault"; + cuda2hipRename["cudaStreamNonBlocking"] = "hipStreamNonBlocking"; + + // Other synchronization + cuda2hipRename["cudaDeviceSynchronize"] = "hipDeviceSynchronize"; + cuda2hipRename["cudaThreadSynchronize"] = "hipDeviceSynchronize"; // translate deprecated cudaThreadSynchronize + cuda2hipRename["cudaDeviceReset"] = "hipDeviceReset"; + cuda2hipRename["cudaThreadExit"] = "hipDeviceReset"; // translate deprecated cudaThreadExit + cuda2hipRename["cudaSetDevice"] = "hipSetDevice"; + cuda2hipRename["cudaGetDevice"] = "hipGetDevice"; + + // Device + cuda2hipRename["cudaDeviceProp"] = "hipDeviceProp_t"; + cuda2hipRename["cudaGetDeviceProperties"] = "hipDeviceGetProperties"; + + // Cache config + cuda2hipRename["cudaDeviceSetCacheConfig"] = "hipDeviceSetCacheConfig"; + cuda2hipRename["cudaThreadSetCacheConfig"] = "hipDeviceSetCacheConfig"; // translate deprecated + cuda2hipRename["cudaDeviceGetCacheConfig"] = "hipDeviceGetCacheConfig"; + cuda2hipRename["cudaThreadGetCacheConfig"] = "hipDeviceGetCacheConfig"; // translate deprecated + cuda2hipRename["cudaFuncCache"] = "hipFuncCache"; + cuda2hipRename["cudaFuncCachePreferNone"] = "hipFuncCachePreferNone"; + cuda2hipRename["cudaFuncCachePreferShared"] = "hipFuncCachePreferShared"; + cuda2hipRename["cudaFuncCachePreferL1"] = "hipFuncCachePreferL1"; + cuda2hipRename["cudaFuncCachePreferEqual"] = "hipFuncCachePreferEqual"; + // function + cuda2hipRename["cudaFuncSetCacheConfig"] = "hipFuncSetCacheConfig"; + + cuda2hipRename["cudaDriverGetVersion"] = "hipDriverGetVersion"; + + // Peer2Peer + cuda2hipRename["cudaDeviceCanAccessPeer"] = "hipDeviceCanAccessPeer"; + cuda2hipRename["cudaDeviceDisablePeerAccess"] = "hipDeviceDisablePeerAccess"; + cuda2hipRename["cudaDeviceEnablePeerAccess"] = "hipDeviceEnablePeerAccess"; + cuda2hipRename["cudaMemcpyPeerAsync"] = "hipMemcpyPeerAsync"; + cuda2hipRename["cudaMemcpyPeer"] = "hipMemcpyPeer"; + + // Shared mem: + cuda2hipRename["cudaDeviceSetSharedMemConfig"] = "hipDeviceSetSharedMemConfig"; + cuda2hipRename["cudaThreadSetSharedMemConfig"] = "hipDeviceSetSharedMemConfig"; // translate deprecated + cuda2hipRename["cudaDeviceGetSharedMemConfig"] = "hipDeviceGetSharedMemConfig"; + cuda2hipRename["cudaThreadGetSharedMemConfig"] = "hipDeviceGetSharedMemConfig"; // translate deprecated + cuda2hipRename["cudaSharedMemConfig"] = "hipSharedMemConfig"; + cuda2hipRename["cudaSharedMemBankSizeDefault"] = "hipSharedMemBankSizeDefault"; + cuda2hipRename["cudaSharedMemBankSizeFourByte"] = "hipSharedMemBankSizeFourByte"; + cuda2hipRename["cudaSharedMemBankSizeEightByte"] = "hipSharedMemBankSizeEightByte"; + + cuda2hipRename["cudaGetDeviceCount"] = "hipGetDeviceCount"; + + // Profiler + //cuda2hipRename["cudaProfilerInitialize"] = "hipProfilerInitialize"; // see if these are called anywhere. + cuda2hipRename["cudaProfilerStart"] = "hipProfilerStart"; + cuda2hipRename["cudaProfilerStop"] = "hipProfilerStop"; + + cuda2hipRename["cudaChannelFormatDesc"] = "hipChannelFormatDesc"; + cuda2hipRename["cudaFilterModePoint"] = "hipFilterModePoint"; + cuda2hipRename["cudaReadModeElementType"] = "hipReadModeElementType"; + + cuda2hipRename["cudaCreateChannelDesc"] = "hipCreateChannelDesc"; + cuda2hipRename["cudaBindTexture"] = "hipBindTexture"; + cuda2hipRename["cudaUnbindTexture"] = "hipUnbindTexture"; + } + DenseMap cuda2hipRename; + }; + + struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { + HipifyPPCallbacks(Replacements * R) + : SeenEnd(false), _sm(nullptr), Replace(R) + { + } + + virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override + { + Preprocessor &PP = CI.getPreprocessor(); + SourceManager & SM = CI.getSourceManager(); + setSourceManager(&SM); + PP.addPPCallbacks(std::unique_ptr(this)); + PP.Retain(); + return true; + } + + virtual void InclusionDirective( + SourceLocation hash_loc, + const Token &include_token, + StringRef file_name, + bool is_angled, + CharSourceRange filename_range, + const FileEntry *file, + StringRef search_path, + StringRef relative_path, + const Module *imported) override + { + if (_sm->isWrittenInMainFile(hash_loc)) { + if (is_angled) { + if (N.cuda2hipRename.count(file_name)) { + std::string repName = N.cuda2hipRename[file_name]; + llvm::errs() << "\nInclude file found: " << file_name << "\n"; + llvm::errs() << "\nSourceLocation:"; filename_range.getBegin().dump(*_sm); + llvm::errs() << "\nWill be replaced with " << repName << "\n"; + SourceLocation sl = filename_range.getBegin(); + SourceLocation sle = filename_range.getEnd(); + const char* B = _sm->getCharacterData(sl); + const char* E = _sm->getCharacterData(sle); + repName = "<" + repName + ">"; + Replacement Rep(*_sm, sl, E - B, repName); + Replace->insert(Rep); + } + } + } + } + + virtual void MacroDefined(const Token &MacroNameTok, + const MacroDirective *MD) override + { + if (_sm->isWrittenInMainFile(MD->getLocation()) && + MD->getKind() == MacroDirective::MD_Define) + { + for (auto T : MD->getMacroInfo()->tokens()) + { + if (T.isAnyIdentifier()) { + StringRef name = T.getIdentifierInfo()->getName(); + if (N.cuda2hipRename.count(name)) { + StringRef repName = N.cuda2hipRename[name]; + llvm::errs() << "\nIdentifier " << name + << " found in definition of macro " << MacroNameTok.getIdentifierInfo()->getName() << "\n"; + llvm::errs() << "\nwill be replaced with: " << repName << "\n"; + SourceLocation sl = T.getLocation(); + llvm::errs() << "\nSourceLocation: ";sl.dump(*_sm); + llvm::errs() << "\n"; + Replacement Rep(*_sm, sl, name.size(), repName); + Replace->insert(Rep); + } + } + } + } + } + + void EndOfMainFile() override + { + + } + + bool SeenEnd; + void setSourceManager(SourceManager * sm) { _sm = sm; } + + private: + + SourceManager * _sm; + Replacements * Replace; + struct hipName N; + }; + +class Cuda2HipCallback : public MatchFinder::MatchCallback { + public: + Cuda2HipCallback(Replacements *Replace) : Replace(Replace) {} + + void run(const MatchFinder::MatchResult &Result) override { + + SourceManager * SM = Result.SourceManager; + + if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) + { + const FunctionDecl * funcDcl = call->getDirectCallee(); + std::string name = funcDcl->getDeclName().getAsString(); + if (N.cuda2hipRename.count(name)) { + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = call->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); + } + } + + if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) + { + LangOptions DefaultLangOptions; + + const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); + + const ParmVarDecl * pvdFirst = kernelDecl->getParamDecl(0); + const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams()-1); + SourceLocation kernelArgListStart(pvdFirst->getLocStart()); + SourceLocation kernelArgListEnd(pvdLast->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); + size_t replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); + std::string outs(SM->getCharacterData(kernelArgListStart), replacementLength); + llvm::outs() << "initial paramlist: " << outs.c_str() << "\n"; + outs = "hipLaunchParm lp, " + outs; + llvm::outs() << "new paramlist: " << outs.c_str() << "\n"; + Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, outs); + Replace->insert(Rep0); + + + std::string name = kernelDecl->getDeclName().getAsString(); + std::string repName = "hipLaunchKernel(HIP_KERNEL_NAME(" + name + "), "; + + + const CallExpr * config = launchKernel->getConfig(); + llvm::outs() << "\nKernel config arguments:\n"; + for (unsigned argno = 0; argno < config->getNumArgs(); argno++) + { + const Expr * arg = config->getArg(argno); + if (!isa(arg)) { + std::string typeCtor = ""; + const ParmVarDecl * pvd = config->getDirectCallee()->getParamDecl(argno); + + SourceLocation sl(arg->getLocStart()); + SourceLocation el(arg->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + llvm::outs() << "args[ " << argno << "]" << outs.c_str() << " <" << pvd->getType().getAsString() << ">\n"; + if (pvd->getType().getAsString().compare("dim3") == 0) + repName += " dim3(" + outs + "),"; + else + repName += " " + outs + ","; + } else + repName += " 0,"; + } + + for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) + { + const Expr * arg = launchKernel->getArg(argno); + SourceLocation sl(arg->getLocStart()); + SourceLocation el(arg->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + llvm::outs() << outs.c_str() << "\n"; + repName += " " + outs + ","; + } + repName.pop_back(); + repName += ")"; + size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(launchKernel->getLocEnd(), 0, *SM, DefaultLangOptions)) - + SM->getCharacterData(launchKernel->getLocStart()); + Replacement Rep(*SM, launchKernel->getLocStart(), length, repName); + Replace->insert(Rep); + } + + if (const MemberExpr * threadIdx = Result.Nodes.getNodeAs("cudaBuiltin")) + { + if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { + if (const DeclRefExpr * declRef = dyn_cast(refBase->getSourceExpr())) { + std::string name = declRef->getDecl()->getNameAsString(); + std::string memberName = threadIdx->getMemberDecl()->getNameAsString(); + size_t pos = memberName.find_first_not_of("__fetch_builtin_"); + memberName = memberName.substr(pos, memberName.length() - pos); + name += "." + memberName; + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = threadIdx->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); + } + } + } + + if (const DeclRefExpr * cudaEnumConstant = Result.Nodes.getNodeAs("cudaEnumConstant")) + { + std::string name = cudaEnumConstant->getDecl()->getNameAsString(); + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = cudaEnumConstant->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); + } + + if (const VarDecl * cudaStructVar = Result.Nodes.getNodeAs("cudaStructVar")) + { + std::string name = + cudaStructVar->getType()->getAsStructureType()->getDecl()->getNameAsString(); + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = cudaStructVar->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); + } + } + + private: + Replacements *Replace; + struct hipName N; +}; + +} // end anonymous namespace + +// Set up the command line options +static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage); +static cl::OptionCategory ToolTemplateCategory("CUDA to HIP source translator options"); + +int main(int argc, const char **argv) { + + llvm::sys::PrintStackTraceOnErrorSignal(); + + int Result; + + CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory); + std::vector savedSources; + for (auto I : OptionsParser.getSourcePathList()) + { + size_t pos = I.find(".cu"); + if (pos != std::string::npos) + { + std::string dst = I.substr(0, pos) + ".hip.cu"; + std::ifstream source(I, std::ios::binary); + std::ofstream dest(dst, std::ios::binary); + dest << source.rdbuf(); + source.close(); + dest.close(); + savedSources.push_back(dst); + } + } + + RefactoringTool Tool(OptionsParser.getCompilations(), savedSources); + ast_matchers::MatchFinder Finder; + Cuda2HipCallback Callback(&Tool.getReplacements()); + HipifyPPCallbacks PPCallbacks(&Tool.getReplacements()); + Finder.addMatcher(callExpr(isExpansionInMainFile(), callee(functionDecl(matchesName("cuda.*")))).bind("cudaCall"), &Callback); + Finder.addMatcher(cudaKernelCallExpr().bind("cudaLaunchKernel"), &Callback); + Finder.addMatcher(memberExpr(isExpansionInMainFile(), hasObjectExpression(hasType(cxxRecordDecl(matchesName("__cuda_builtin_"))))).bind("cudaBuiltin"), &Callback); + Finder.addMatcher(declRefExpr(isExpansionInMainFile(), to(enumConstantDecl(matchesName("cuda.*")))).bind("cudaEnumConstant"), &Callback); + Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(cxxRecordDecl(matchesName("cuda.*")))).bind("cudaStructVar"), &Callback); + + auto action = newFrontendActionFactory(&Finder, &PPCallbacks); + + std::vector compilationStages; + compilationStages.push_back("--cuda-host-only"); + compilationStages.push_back("--cuda-device-only"); + + for (auto Stage : compilationStages) + { + Tool.appendArgumentsAdjuster(combineAdjusters( + getInsertArgumentAdjuster(Stage, ArgumentInsertPosition::BEGIN), + getClangSyntaxOnlyAdjuster())); + + Result = Tool.run(action.get()); + + Tool.clearArgumentsAdjusters(); + } + + LangOptions DefaultLangOptions; + IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); + TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts); + DiagnosticsEngine Diagnostics( + IntrusiveRefCntPtr(new DiagnosticIDs()), + &*DiagOpts, &DiagnosticPrinter, false); + SourceManager Sources(Diagnostics, Tool.getFiles()); + + llvm::outs() << "Replacements collected by the tool:\n"; + for (auto &r : Tool.getReplacements()) { + llvm::outs() << r.toString() << "\n"; + } + + Rewriter Rewrite(Sources, DefaultLangOptions); + + if (!Tool.applyAllReplacements(Rewrite)) { + llvm::errs() << "Skipped some replacements.\n"; + } + + Result = Rewrite.overwriteChangedFiles(); + + + for (auto I : savedSources) + { + size_t pos = I.find(".cu"); + if (pos != std::string::npos) + { + rename(I.c_str(), I.substr(0, pos).c_str()); + } + } + return Result; +} From dca4a70bb7d3d4109fae983435441963e65332a9 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Thu, 11 Feb 2016 15:27:00 +0300 Subject: [PATCH 03/82] adding ability to build in llvm source tree, updated README --- CMakeLists.txt | 39 ++++++++++++++++++++++++++------------- README.md | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 57 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d727c70be..56845f1b6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,25 @@ -cmake_minimum_required(VERSION 2.8.8) +if(${HIPIFY_STANDLONE}) + cmake_minimum_required(VERSION 2.8.8) -project(hipify) + project(hipify) -find_package(LLVM REQUIRED PATHS ${LLVM_DIR} NO_DEFAULT_PATH) + find_package(LLVM REQUIRED PATHS ${LLVM_DIR} NO_DEFAULT_PATH) -message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") -message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") + message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") + message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") -include_directories(${LLVM_INCLUDE_DIRS}) -link_directories(${LLVM_LIBRARY_DIRS}) -add_definitions(${LLVM_DEFINITIONS}) + include_directories(${LLVM_INCLUDE_DIRS}) + link_directories(${LLVM_LIBRARY_DIRS}) + add_definitions(${LLVM_DEFINITIONS}) + add_executable( hipify src/Cuda2Hip.cpp ) +else() + set(LLVM_LINK_COMPONENTS + Option + Support + ) + add_clang_executable(hipify src/Cuda2Hip.cpp) +endif() -# Now build our tools -add_executable(hipify src/Cuda2Hip.cpp) # Link against LLVM and CLANG tools libraries target_link_libraries(hipify @@ -37,6 +44,12 @@ target_link_libraries(hipify LLVMOption LLVMCore) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -fno-rtti -fvisibility-inlines-hidden") +if(${HIPIFY_STANDLONE}) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fno-rtti -fvisibility-inlines-hidden") +else() + install(TARGETS hipify + RUNTIME DESTINATION bin + COMPONENT clang-extras) +endif() diff --git a/README.md b/README.md index a813325e65..08b3a5eb5f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,36 @@ # HIPIFY The CLANG-based HIPIFY tool - translates CUDA to [HIP](https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/blob/master/README.md) -# How to Build -- Get LLVM and CLANG sources and build CLANG, then install it to a **LLVM_INSTALL_PATH** folder -- make build dir for hipify and run the folloing commands there: +# How to Build *standalone* tool +- Get LLVM and CLANG sources, build them and install to a **LLVM_INSTALL_PATH** folder +- mkdir for hipify, run cmake there and build the tool: ``` -> cmake -DLLVM_DIR="LLVM_INSTALL_PATH" path_to_hipify_src -> make +git clone http://llvm.org/git/llvm.git llvm +git clone http://llvm.org/git/clang.git llvm/tools/clang + +mkdir llvm_build && cd llvm_build +cmake -DCMAKE_INSTALL_PREFIX="LLVM_INSTALL_PATH" -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm +make && make install + +git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git path_to_hipify_src +mkdir path_to_hipify_src/build && cd path_to_hipify_src/build +cmake -DLLVM_DIR="LLVM_INSTALL_PATH" -DHIPIFY_STANDLONE=1 .. +make ``` + +# How to Build tool *in llvm source tree* +- get LLVM, CLANG and clang-tools-extra sources +- put hipify folder into llvm/tools/clang/tools/extra, add it to llvm/tools/clang/tools/extra/CMakeLists.txt +- run cmake and build tool +``` +git clone http://llvm.org/git/llvm.git llvm +git clone http://llvm.org/git/clang.git llvm/tools/clang +git clone http://llvm.org/git/clang-tools-extra.git llvm/tools/clang/tools/extra +git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git llvm/tools/clang/tools/extra/hipify +echo "add_subdirectory(hipify)" >> llvm/tools/clang/tools/extra/CMakeLists.txt + +mkdir llvm_build && cd llvm_build +cmake -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm +make -C tools/clang/tools/extra/hipify +``` + From 434c070ea7ed2bf6c5da134584e31dcb0ac51fa1 Mon Sep 17 00:00:00 2001 From: atimofee Date: Wed, 17 Feb 2016 18:34:58 +0300 Subject: [PATCH 04/82] Hipify tool in it current state --- src/Cuda2Hip.cpp | 177 ++++++++++++++++++++++++++++------------------- 1 file changed, 105 insertions(+), 72 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index c4c8f58810..fe3f360dce 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -1,29 +1,39 @@ -/* -Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +//===---- tools/extra/ToolTemplate.cpp - Template for refactoring tool ----===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements an empty refactoring tool using the clang tooling. +// The goal is to lower the "barrier to entry" for writing refactoring tools. +// +// Usage: +// tool-template ... +// +// Where is a CMake build directory in which a file named +// compile_commands.json exists (enable -DCMAKE_EXPORT_COMPILE_COMMANDS in +// CMake to get this output). +// +// ... specify the paths of files in the CMake source tree. This path +// is looked up in the compile command database. If the path of a file is +// absolute, it needs to point into CMake's source tree. If the path is +// relative, the current working directory needs to be in the CMake source +// tree and the file must be in a subdirectory of the current working +// directory. "./" prefixes in the relative files will be automatically +// removed, but the rest of a relative path must be a suffix of a path in +// the compile command line database. +// +// For example, to use tool-template on all files in a subtree of the +// source tree, use: +// +// /path/in/subtree $ find . -name '*.cpp'| +// xargs tool-template /path/to/build +// +//===----------------------------------------------------------------------===// -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ -/** - * @file Cuda2Hip.cpp - * - * This file is compiled and linked into clang based hipify tool. - */ #include "clang/ASTMatchers/ASTMatchers.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Basic/SourceManager.h" @@ -65,7 +75,7 @@ namespace { // Error codes and return types: cuda2hipRename["cudaError_t"] = "hipError_t"; - cuda2hipRename["cudaError"] = "hipError_t"; + cuda2hipRename["cudaError"] = "hipError"; cuda2hipRename["cudaSuccess"] = "hipSuccess"; cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; @@ -138,7 +148,7 @@ namespace { cuda2hipRename["warpSize"] = "hipWarpSize"; - // Events + // Events cuda2hipRename["cudaEvent_t"] = "hipEvent_t"; cuda2hipRename["cudaEventCreate"] = "hipEventCreate"; cuda2hipRename["cudaEventCreateWithFlags"] = "hipEventCreateWithFlags"; @@ -157,7 +167,7 @@ namespace { cuda2hipRename["cudaStreamDefault"] = "hipStreamDefault"; cuda2hipRename["cudaStreamNonBlocking"] = "hipStreamNonBlocking"; - // Other synchronization + // Other synchronization cuda2hipRename["cudaDeviceSynchronize"] = "hipDeviceSynchronize"; cuda2hipRename["cudaThreadSynchronize"] = "hipDeviceSynchronize"; // translate deprecated cudaThreadSynchronize cuda2hipRename["cudaDeviceReset"] = "hipDeviceReset"; @@ -165,7 +175,7 @@ namespace { cuda2hipRename["cudaSetDevice"] = "hipSetDevice"; cuda2hipRename["cudaGetDevice"] = "hipGetDevice"; - // Device + // Device cuda2hipRename["cudaDeviceProp"] = "hipDeviceProp_t"; cuda2hipRename["cudaGetDeviceProperties"] = "hipDeviceGetProperties"; @@ -219,22 +229,22 @@ namespace { DenseMap cuda2hipRename; }; - struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { - HipifyPPCallbacks(Replacements * R) - : SeenEnd(false), _sm(nullptr), Replace(R) - { - } - - virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override - { - Preprocessor &PP = CI.getPreprocessor(); - SourceManager & SM = CI.getSourceManager(); - setSourceManager(&SM); - PP.addPPCallbacks(std::unique_ptr(this)); - PP.Retain(); - return true; - } - + struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { + HipifyPPCallbacks(Replacements * R) + : SeenEnd(false), _sm(nullptr), Replace(R) + { + } + + virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override + { + Preprocessor &PP = CI.getPreprocessor(); + SourceManager & SM = CI.getSourceManager(); + setSourceManager(&SM); + PP.addPPCallbacks(std::unique_ptr(this)); + PP.Retain(); + return true; + } + virtual void InclusionDirective( SourceLocation hash_loc, const Token &include_token, @@ -255,8 +265,8 @@ namespace { llvm::errs() << "\nWill be replaced with " << repName << "\n"; SourceLocation sl = filename_range.getBegin(); SourceLocation sle = filename_range.getEnd(); - const char* B = _sm->getCharacterData(sl); - const char* E = _sm->getCharacterData(sle); + const char* B = _sm->getCharacterData(sl); + const char* E = _sm->getCharacterData(sle); repName = "<" + repName + ">"; Replacement Rep(*_sm, sl, E - B, repName); Replace->insert(Rep); @@ -290,22 +300,22 @@ namespace { } } } - - void EndOfMainFile() override - { - - } - - bool SeenEnd; - void setSourceManager(SourceManager * sm) { _sm = sm; } - - private: - - SourceManager * _sm; - Replacements * Replace; - struct hipName N; - }; - + + void EndOfMainFile() override + { + + } + + bool SeenEnd; + void setSourceManager(SourceManager * sm) { _sm = sm; } + + private: + + SourceManager * _sm; + Replacements * Replace; + struct hipName N; + }; + class Cuda2HipCallback : public MatchFinder::MatchCallback { public: Cuda2HipCallback(Replacements *Replace) : Replace(Replace) {} @@ -349,7 +359,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { std::string name = kernelDecl->getDeclName().getAsString(); std::string repName = "hipLaunchKernel(HIP_KERNEL_NAME(" + name + "), "; - + const CallExpr * config = launchKernel->getConfig(); llvm::outs() << "\nKernel config arguments:\n"; @@ -359,7 +369,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { if (!isa(arg)) { std::string typeCtor = ""; const ParmVarDecl * pvd = config->getDirectCallee()->getParamDecl(argno); - + SourceLocation sl(arg->getLocStart()); SourceLocation el(arg->getLocEnd()); SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); @@ -372,7 +382,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { } else repName += " 0,"; } - + for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) { const Expr * arg = launchKernel->getArg(argno); @@ -409,11 +419,21 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { } } - if (const DeclRefExpr * cudaEnumConstant = Result.Nodes.getNodeAs("cudaEnumConstant")) + if (const DeclRefExpr * cudaEnumConstantRef = Result.Nodes.getNodeAs("cudaEnumConstantRef")) { - std::string name = cudaEnumConstant->getDecl()->getNameAsString(); + std::string name = cudaEnumConstantRef->getDecl()->getNameAsString(); std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = cudaEnumConstant->getLocStart(); + SourceLocation sl = cudaEnumConstantRef->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); + } + + if (const VarDecl * cudaEnumConstantDecl = Result.Nodes.getNodeAs("cudaEnumConstantDecl")) + { + std::string name = cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = cudaEnumConstantDecl->getLocStart(); Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); Replace->insert(Rep); @@ -429,6 +449,17 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); Replace->insert(Rep); } + + if (const ParmVarDecl * cudaParamDecl = Result.Nodes.getNodeAs("cudaParamDecl")) + { + QualType QT = cudaParamDecl->getOriginalType(); + std::string name = QT.getAsString(); + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = cudaParamDecl->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); + } } private: @@ -447,7 +478,7 @@ int main(int argc, const char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(); int Result; - + CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory); std::vector savedSources; for (auto I : OptionsParser.getSourcePathList()) @@ -472,8 +503,10 @@ int main(int argc, const char **argv) { Finder.addMatcher(callExpr(isExpansionInMainFile(), callee(functionDecl(matchesName("cuda.*")))).bind("cudaCall"), &Callback); Finder.addMatcher(cudaKernelCallExpr().bind("cudaLaunchKernel"), &Callback); Finder.addMatcher(memberExpr(isExpansionInMainFile(), hasObjectExpression(hasType(cxxRecordDecl(matchesName("__cuda_builtin_"))))).bind("cudaBuiltin"), &Callback); - Finder.addMatcher(declRefExpr(isExpansionInMainFile(), to(enumConstantDecl(matchesName("cuda.*")))).bind("cudaEnumConstant"), &Callback); + Finder.addMatcher(declRefExpr(isExpansionInMainFile(), to(enumConstantDecl(matchesName("cuda.*")))).bind("cudaEnumConstantRef"), &Callback); + Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(enumDecl(matchesName("cuda.*")))).bind("cudaEnumConstantDecl"), &Callback); Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(cxxRecordDecl(matchesName("cuda.*")))).bind("cudaStructVar"), &Callback); + Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); auto action = newFrontendActionFactory(&Finder, &PPCallbacks); @@ -491,7 +524,7 @@ int main(int argc, const char **argv) { Tool.clearArgumentsAdjusters(); } - + LangOptions DefaultLangOptions; IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts); From a0720fe79afa87063d33bb5163913944e3b083f4 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Wed, 17 Feb 2016 19:05:18 +0300 Subject: [PATCH 05/82] Adding lit tests --- CMakeLists.txt | 9 ++++++-- README.md | 13 ++++++++++- test/CMakeLists.txt | 27 ++++++++++++++++++++++ test/axpy.cu | 43 +++++++++++++++++++++++++++++++++++ test/lit.cfg | 54 ++++++++++++++++++++++++++++++++++++++++++++ test/lit.site.cfg.in | 15 ++++++++++++ 6 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 test/CMakeLists.txt create mode 100644 test/axpy.cu create mode 100644 test/lit.cfg create mode 100644 test/lit.site.cfg.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 56845f1b6e..8915cc4714 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,21 @@ if(${HIPIFY_STANDLONE}) cmake_minimum_required(VERSION 2.8.8) - + project(hipify) find_package(LLVM REQUIRED PATHS ${LLVM_DIR} NO_DEFAULT_PATH) + list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR}) + include(AddLLVM) + message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") include_directories(${LLVM_INCLUDE_DIRS}) link_directories(${LLVM_LIBRARY_DIRS}) add_definitions(${LLVM_DEFINITIONS}) - add_executable( hipify src/Cuda2Hip.cpp ) + add_llvm_executable( hipify src/Cuda2Hip.cpp ) + else() set(LLVM_LINK_COMPONENTS Option @@ -48,6 +52,7 @@ if(${HIPIFY_STANDLONE}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fno-rtti -fvisibility-inlines-hidden") + add_subdirectory(test) else() install(TARGETS hipify RUNTIME DESTINATION bin diff --git a/README.md b/README.md index 08b3a5eb5f..a3725394ad 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ git clone http://llvm.org/git/llvm.git llvm git clone http://llvm.org/git/clang.git llvm/tools/clang mkdir llvm_build && cd llvm_build -cmake -DCMAKE_INSTALL_PREFIX="LLVM_INSTALL_PATH" -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm +cmake -DCMAKE_INSTALL_PREFIX="LLVM_INSTALL_PATH" -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm make && make install git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git path_to_hipify_src @@ -34,3 +34,14 @@ cmake -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm make -C tools/clang/tools/extra/hipify ``` +# How to run tests (for *standalone* tool only) +- install Python and add python-setuptools +- install lit python script +- make sure that FileCheck util is installed to **LLVM_INSTALL_PATH/bin/FileCheck** +- run tests from path_to_hipify_src/build +``` +sudo apt-get install python python-setuptools +sudo easy_install lit +make -C path_to_hipify_src/build test +``` + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000000..4f74091b0b --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,27 @@ +set(Python_ADDITIONAL_VERSIONS 2.7) +include(FindPythonInterp) +if( NOT PYTHONINTERP_FOUND ) + message(FATAL_ERROR + "Unable to find Python interpreter, required for builds and testing\n\n" + "Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") +endif() + +set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg + @ONLY) + +add_lit_testsuite(check-hipify "Running HIPify regression tests" + ${CMAKE_CURRENT_SOURCE_DIR} + PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg + DEPENDS hipify + ) + +add_custom_target(check) +add_dependencies(check check-hipify) +add_custom_target(test) +add_dependencies(test check-hipify) +set_target_properties(check PROPERTIES FOLDER "Tests") + diff --git a/test/axpy.cu b/test/axpy.cu new file mode 100644 index 0000000000..29d5493763 --- /dev/null +++ b/test/axpy.cu @@ -0,0 +1,43 @@ +// RUN: hipify "%s" 2>&1 | FileCheck %s + +#include // for checkCudaErrors + +#include + +__global__ void axpy(float a, float* x, float* y) { + // CHECK: hipThreadIdx_x + y[threadIdx.x] = a * x[threadIdx.x]; +} + +int main(int argc, char* argv[]) { + const int kDataLen = 4; + + float a = 2.0f; + float host_x[kDataLen] = {1.0f, 2.0f, 3.0f, 4.0f}; + float host_y[kDataLen]; + + // Copy input data to device. + float* device_x; + float* device_y; + checkCudaErrors(cudaMalloc(&device_x, kDataLen * sizeof(float))); + checkCudaErrors(cudaMalloc(&device_y, kDataLen * sizeof(float))); + checkCudaErrors(cudaMemcpy(device_x, host_x, kDataLen * sizeof(float), + cudaMemcpyHostToDevice)); + + // Launch the kernel. + // CHECK: hipLaunchKernel(HIP_KERNEL_NAME + axpy<<<1, kDataLen>>>(a, device_x, device_y); + + // Copy output data to host. + checkCudaErrors(cudaDeviceSynchronize()); + checkCudaErrors(cudaMemcpy(host_y, device_y, kDataLen * sizeof(float), + cudaMemcpyDeviceToHost)); + + // Print the results. + for (int i = 0; i < kDataLen; ++i) { + std::cout << "y[" << i << "] = " << host_y[i] << "\n"; + } + + checkCudaErrors(cudaDeviceReset()); + return 0; +} diff --git a/test/lit.cfg b/test/lit.cfg new file mode 100644 index 0000000000..775cdbf0d4 --- /dev/null +++ b/test/lit.cfg @@ -0,0 +1,54 @@ +# -*- Python -*- +import os +import platform +import re +import subprocess + +import lit.formats +import lit.util + +# Configuration file for the 'lit' test runner. + +# name: The name of this test suite. +config.name = 'hipify' + +# suffixes: CUDA source is only supported +config.suffixes = ['.cu'] + +# testFormat: The test format to use to interpret tests. +config.test_format = lit.formats.ShTest() + +# test_source_root: The root path where tests are located. +config.test_source_root = os.path.dirname(__file__) + +# test_exec_root: The path where tests are located (default is the test suite root). +#config.test_exec_root = config.test_source_root + +# target_triple: Used by ShTest and TclTest formats for XFAIL checks. +config.target_triple = '(unused)' + +# available_features: Used by ShTest and TclTest formats for REQUIRES checks. +config.available_features = [] + +site_cfg = lit_config.params.get('site_config', None) +lit_config.load_config(config, site_cfg) + +obj_root = getattr(config, 'obj_root', None) +if obj_root is not None: + config.test_exec_root = obj_root + +if obj_root is not None: + llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) + if not llvm_tools_dir: + lit_config.fatal('No LLVM tools dir set!') + path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) + config.environment['PATH'] = path + +tool_name = "FileCheck" +tool_path = lit.util.which(tool_name, llvm_tools_dir) +if not tool_path: + # Warn, but still provide a substitution. + lit_config.note('Did not find ' + tool_name + ' in ' + llvm_tools_dir) + tool_path = llvm_tools_dir + '/' + tool_name +config.substitutions.append((tool_name, tool_path)) + diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in new file mode 100644 index 0000000000..6fc35440d4 --- /dev/null +++ b/test/lit.site.cfg.in @@ -0,0 +1,15 @@ +import sys + +config.llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@" +config.obj_root = "@CMAKE_CURRENT_BINARY_DIR@" + +# Support substitution of the tools and libs dirs with user parameters. This is +# used when we can't determine the tool dir at configuration time. +try: + config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params + config.obj_root = config.obj_root % lit_config.params +except KeyError: + e = sys.exc_info()[1] + key, = e.args + lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) + From f3dfd07fa57af14a6ea007767598ba6eeda91fb9 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Thu, 18 Feb 2016 23:16:52 +0300 Subject: [PATCH 06/82] fix build bug with current clang/llvm --- src/Cuda2Hip.cpp | 76 ++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index fe3f360dce..f8cf938f32 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -229,22 +229,22 @@ namespace { DenseMap cuda2hipRename; }; - struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { - HipifyPPCallbacks(Replacements * R) - : SeenEnd(false), _sm(nullptr), Replace(R) - { - } - - virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override - { - Preprocessor &PP = CI.getPreprocessor(); - SourceManager & SM = CI.getSourceManager(); - setSourceManager(&SM); - PP.addPPCallbacks(std::unique_ptr(this)); - PP.Retain(); - return true; - } - + struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { + HipifyPPCallbacks(Replacements * R) + : SeenEnd(false), _sm(nullptr), Replace(R) + { + } + + virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override + { + Preprocessor &PP = CI.getPreprocessor(); + SourceManager & SM = CI.getSourceManager(); + setSourceManager(&SM); + PP.addPPCallbacks(std::unique_ptr(this)); + PP.Retain(); + return true; + } + virtual void InclusionDirective( SourceLocation hash_loc, const Token &include_token, @@ -254,7 +254,7 @@ namespace { const FileEntry *file, StringRef search_path, StringRef relative_path, - const Module *imported) override + const clang::Module *imported) override { if (_sm->isWrittenInMainFile(hash_loc)) { if (is_angled) { @@ -265,8 +265,8 @@ namespace { llvm::errs() << "\nWill be replaced with " << repName << "\n"; SourceLocation sl = filename_range.getBegin(); SourceLocation sle = filename_range.getEnd(); - const char* B = _sm->getCharacterData(sl); - const char* E = _sm->getCharacterData(sle); + const char* B = _sm->getCharacterData(sl); + const char* E = _sm->getCharacterData(sle); repName = "<" + repName + ">"; Replacement Rep(*_sm, sl, E - B, repName); Replace->insert(Rep); @@ -300,22 +300,22 @@ namespace { } } } - - void EndOfMainFile() override - { - - } - - bool SeenEnd; - void setSourceManager(SourceManager * sm) { _sm = sm; } - - private: - - SourceManager * _sm; - Replacements * Replace; - struct hipName N; - }; - + + void EndOfMainFile() override + { + + } + + bool SeenEnd; + void setSourceManager(SourceManager * sm) { _sm = sm; } + + private: + + SourceManager * _sm; + Replacements * Replace; + struct hipName N; + }; + class Cuda2HipCallback : public MatchFinder::MatchCallback { public: Cuda2HipCallback(Replacements *Replace) : Replace(Replace) {} @@ -452,8 +452,8 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { if (const ParmVarDecl * cudaParamDecl = Result.Nodes.getNodeAs("cudaParamDecl")) { - QualType QT = cudaParamDecl->getOriginalType(); - std::string name = QT.getAsString(); + QualType QT = cudaParamDecl->getOriginalType(); + std::string name = QT.getAsString(); std::string repName = N.cuda2hipRename[name]; SourceLocation sl = cudaParamDecl->getLocStart(); Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? @@ -506,7 +506,7 @@ int main(int argc, const char **argv) { Finder.addMatcher(declRefExpr(isExpansionInMainFile(), to(enumConstantDecl(matchesName("cuda.*")))).bind("cudaEnumConstantRef"), &Callback); Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(enumDecl(matchesName("cuda.*")))).bind("cudaEnumConstantDecl"), &Callback); Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(cxxRecordDecl(matchesName("cuda.*")))).bind("cudaStructVar"), &Callback); - Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); + Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); auto action = newFrontendActionFactory(&Finder, &PPCallbacks); From 4b13cfc46009885d3b3fd0d8f0a8c11d7cd0941e Mon Sep 17 00:00:00 2001 From: atimofee Date: Fri, 19 Feb 2016 21:58:33 +0300 Subject: [PATCH 07/82] Added CUDA names replacement in string literals (i.e. error messages) --- src/Cuda2Hip.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index fe3f360dce..ff6f0c9262 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -460,6 +460,21 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); Replace->insert(Rep); } + if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) + { + std::string s = stringLiteral->getString(); + std::string search("cuda"), replace("hip"); + size_t pos = 0; + while ((pos = s.find("cuda", pos)) != std::string::npos) { + llvm::outs() << "String Literal: " << s << "\n"; + s.replace(pos, search.length(), replace); + pos += replace.length(); + SourceLocation sl = stringLiteral->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, stringLiteral->getLength(), s); + Replace->insert(Rep); + } + } } private: @@ -507,6 +522,7 @@ int main(int argc, const char **argv) { Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(enumDecl(matchesName("cuda.*")))).bind("cudaEnumConstantDecl"), &Callback); Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(cxxRecordDecl(matchesName("cuda.*")))).bind("cudaStructVar"), &Callback); Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); + Finder.addMatcher(stringLiteral().bind("stringLiteral"), &Callback); auto action = newFrontendActionFactory(&Finder, &PPCallbacks); From 203152cb281e2e56ab177235a2a53ac01e5199d2 Mon Sep 17 00:00:00 2001 From: atimofee Date: Wed, 24 Feb 2016 17:42:02 +0300 Subject: [PATCH 08/82] CUDA names in string literals replacment added --- src/Cuda2Hip.cpp | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index ff6f0c9262..6a0b6fa42c 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -254,7 +254,7 @@ namespace { const FileEntry *file, StringRef search_path, StringRef relative_path, - const Module *imported) override + const clang::Module *imported) override { if (_sm->isWrittenInMainFile(hash_loc)) { if (is_angled) { @@ -462,18 +462,29 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { } if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) { - std::string s = stringLiteral->getString(); - std::string search("cuda"), replace("hip"); - size_t pos = 0; - while ((pos = s.find("cuda", pos)) != std::string::npos) { - llvm::outs() << "String Literal: " << s << "\n"; - s.replace(pos, search.length(), replace); - pos += replace.length(); - SourceLocation sl = stringLiteral->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, stringLiteral->getLength(), s); - Replace->insert(Rep); - } + StringRef s = stringLiteral->getString(); + + std::pair split = s.split("cuda"); + StringRef cuda = split.second; + while (!cuda.empty()) { + size_t byteNum = split.first.size(); + cuda = cuda.data() - 4; + std::pair name_pair = cuda.split(' '); + StringRef name = name_pair.first; + llvm::outs() << "\nToken: <" << name << "> found in string literal " << s << "\n"; + StringRef repName = N.cuda2hipRename[name]; + if (!repName.empty()) + { + llvm::outs() << "\nWill be replaced with: <" << repName << ">\n"; + SourceLocation sl = stringLiteral->getLocationOfByte(byteNum, *SM, + Result.Context->getLangOpts(), Result.Context->getTargetInfo()); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replace->insert(Rep); + } + split = name_pair.second.split("cuda"); + cuda = split.second; + } } } From 051f008ade582e9ae1888614f7d50102c22bc80e Mon Sep 17 00:00:00 2001 From: dfukalov Date: Wed, 24 Feb 2016 19:10:00 +0300 Subject: [PATCH 09/82] -o= option added --- src/Cuda2Hip.cpp | 103 ++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index f8cf938f32..6716235ea7 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -1,39 +1,29 @@ -//===---- tools/extra/ToolTemplate.cpp - Template for refactoring tool ----===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements an empty refactoring tool using the clang tooling. -// The goal is to lower the "barrier to entry" for writing refactoring tools. -// -// Usage: -// tool-template ... -// -// Where is a CMake build directory in which a file named -// compile_commands.json exists (enable -DCMAKE_EXPORT_COMPILE_COMMANDS in -// CMake to get this output). -// -// ... specify the paths of files in the CMake source tree. This path -// is looked up in the compile command database. If the path of a file is -// absolute, it needs to point into CMake's source tree. If the path is -// relative, the current working directory needs to be in the CMake source -// tree and the file must be in a subdirectory of the current working -// directory. "./" prefixes in the relative files will be automatically -// removed, but the rest of a relative path must be a suffix of a path in -// the compile command line database. -// -// For example, to use tool-template on all files in a subtree of the -// source tree, use: -// -// /path/in/subtree $ find . -name '*.cpp'| -// xargs tool-template /path/to/build -// -//===----------------------------------------------------------------------===// +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +/** + * @file Cuda2Hip.cpp + * + * This file is compiled and linked into clang based hipify tool. + */ #include "clang/ASTMatchers/ASTMatchers.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Basic/SourceManager.h" @@ -470,8 +460,10 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { } // end anonymous namespace // Set up the command line options -static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage); static cl::OptionCategory ToolTemplateCategory("CUDA to HIP source translator options"); +static cl::extrahelp MoreHelp( " specify the path of source file\n\n" ); +static cl::opt +OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::cat(ToolTemplateCategory)); int main(int argc, const char **argv) { @@ -479,24 +471,28 @@ int main(int argc, const char **argv) { int Result; - CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory); - std::vector savedSources; - for (auto I : OptionsParser.getSourcePathList()) - { - size_t pos = I.find(".cu"); - if (pos != std::string::npos) - { - std::string dst = I.substr(0, pos) + ".hip.cu"; - std::ifstream source(I, std::ios::binary); - std::ofstream dest(dst, std::ios::binary); - dest << source.rdbuf(); - source.close(); - dest.close(); - savedSources.push_back(dst); + CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory, llvm::cl::Required); + std::string dst = OutputFilename; + std::vector fileSources = OptionsParser.getSourcePathList(); + if (dst.empty()) { + dst = fileSources[0]; + size_t pos = dst.find(".cu"); + if (pos != std::string::npos) { + dst = dst.substr(0, pos) + ".hip.cu"; + } else { + llvm::errs() << "Input .cu file was not specified.\n"; + return 1; } + } else { + dst += ".cu"; } + std::ifstream source(fileSources[0], std::ios::binary); + std::ofstream dest(dst, std::ios::binary); + dest << source.rdbuf(); + source.close(); + dest.close(); - RefactoringTool Tool(OptionsParser.getCompilations(), savedSources); + RefactoringTool Tool(OptionsParser.getCompilations(), dst); ast_matchers::MatchFinder Finder; Cuda2HipCallback Callback(&Tool.getReplacements()); HipifyPPCallbacks PPCallbacks(&Tool.getReplacements()); @@ -547,12 +543,11 @@ int main(int argc, const char **argv) { Result = Rewrite.overwriteChangedFiles(); - for (auto I : savedSources) { - size_t pos = I.find(".cu"); + size_t pos = dst.find(".cu"); if (pos != std::string::npos) { - rename(I.c_str(), I.substr(0, pos).c_str()); + rename(dst.c_str(), dst.substr(0, pos).c_str()); } } return Result; From 3fbdeafee49150128c7c371e5ab7de6039dc3447 Mon Sep 17 00:00:00 2001 From: atimofee Date: Wed, 24 Feb 2016 19:27:02 +0300 Subject: [PATCH 10/82] TAB deleted --- src/Cuda2Hip.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index b5aa763feb..b57472ca15 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -463,7 +463,6 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) { StringRef s = stringLiteral->getString(); - std::pair split = s.split("cuda"); StringRef cuda = split.second; while (!cuda.empty()) { From 0438f7959e2a2140a1a2f2311e7eb6654d20d868 Mon Sep 17 00:00:00 2001 From: atimofee Date: Wed, 24 Feb 2016 21:22:32 +0300 Subject: [PATCH 11/82] String literal bug fixed + string literal processing refactoring --- src/Cuda2Hip.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 83df1c95b1..5a1432a185 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -453,26 +453,22 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) { StringRef s = stringLiteral->getString(); - std::pair split = s.split("cuda"); - StringRef cuda = split.second; - while (!cuda.empty()) { - size_t byteNum = split.first.size(); - cuda = cuda.data() - 4; - std::pair name_pair = cuda.split(' '); - StringRef name = name_pair.first; + size_t begin = 0; + while ((begin = s.find("cuda", begin)) != StringRef::npos) { + const size_t end = s.find_first_of(" ", begin + 4); + StringRef name = s.slice(begin, end); llvm::outs() << "\nToken: <" << name << "> found in string literal " << s << "\n"; StringRef repName = N.cuda2hipRename[name]; - if (!repName.empty()) - { - llvm::outs() << "\nWill be replaced with: <" << repName << ">\n"; - SourceLocation sl = stringLiteral->getLocationOfByte(byteNum, *SM, - Result.Context->getLangOpts(), Result.Context->getTargetInfo()); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + if (!repName.empty()) { + llvm::outs() << "\nWill be replaced with: <" << repName << "\n"; + SourceLocation sl = stringLiteral->getLocationOfByte(begin, *SM, + Result.Context->getLangOpts(), Result.Context->getTargetInfo()); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); Replace->insert(Rep); } - split = name_pair.second.split("cuda"); - cuda = split.second; + if (end == StringRef::npos) break; + begin = end + 1; } } } From 7b79c7c4fde34533f168bbc64ff0678332b8c035 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Thu, 25 Feb 2016 15:18:14 +0300 Subject: [PATCH 12/82] fixed lit script discovery in standalone build case --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8915cc4714..1a6bc3636d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ if(${HIPIFY_STANDLONE}) link_directories(${LLVM_LIBRARY_DIRS}) add_definitions(${LLVM_DEFINITIONS}) add_llvm_executable( hipify src/Cuda2Hip.cpp ) + find_program(LIT_COMMAND lit) else() set(LLVM_LINK_COMPONENTS From e2379adae30c0bdf5a0cd8010e458ae8065de297 Mon Sep 17 00:00:00 2001 From: atimofee Date: Thu, 25 Feb 2016 22:54:58 +0300 Subject: [PATCH 13/82] Fixed tool crash on kernels with empty parameter list --- src/Cuda2Hip.cpp | 191 ++++++++++++++++++++++++----------------------- 1 file changed, 99 insertions(+), 92 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 5a1432a185..57df437e77 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -307,98 +307,105 @@ namespace { }; class Cuda2HipCallback : public MatchFinder::MatchCallback { - public: - Cuda2HipCallback(Replacements *Replace) : Replace(Replace) {} - - void run(const MatchFinder::MatchResult &Result) override { - - SourceManager * SM = Result.SourceManager; - - if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) - { - const FunctionDecl * funcDcl = call->getDirectCallee(); - std::string name = funcDcl->getDeclName().getAsString(); - if (N.cuda2hipRename.count(name)) { - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = call->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); - Replace->insert(Rep); - } - } - - if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) - { - LangOptions DefaultLangOptions; - - const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); - - const ParmVarDecl * pvdFirst = kernelDecl->getParamDecl(0); - const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams()-1); - SourceLocation kernelArgListStart(pvdFirst->getLocStart()); - SourceLocation kernelArgListEnd(pvdLast->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); - size_t replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); - std::string outs(SM->getCharacterData(kernelArgListStart), replacementLength); - llvm::outs() << "initial paramlist: " << outs.c_str() << "\n"; - outs = "hipLaunchParm lp, " + outs; - llvm::outs() << "new paramlist: " << outs.c_str() << "\n"; - Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, outs); - Replace->insert(Rep0); - - - std::string name = kernelDecl->getDeclName().getAsString(); - std::string repName = "hipLaunchKernel(HIP_KERNEL_NAME(" + name + "), "; - - - const CallExpr * config = launchKernel->getConfig(); - llvm::outs() << "\nKernel config arguments:\n"; - for (unsigned argno = 0; argno < config->getNumArgs(); argno++) - { - const Expr * arg = config->getArg(argno); - if (!isa(arg)) { - std::string typeCtor = ""; - const ParmVarDecl * pvd = config->getDirectCallee()->getParamDecl(argno); - - SourceLocation sl(arg->getLocStart()); - SourceLocation el(arg->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); - std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); - llvm::outs() << "args[ " << argno << "]" << outs.c_str() << " <" << pvd->getType().getAsString() << ">\n"; - if (pvd->getType().getAsString().compare("dim3") == 0) - repName += " dim3(" + outs + "),"; - else - repName += " " + outs + ","; - } else - repName += " 0,"; - } - - for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) - { - const Expr * arg = launchKernel->getArg(argno); - SourceLocation sl(arg->getLocStart()); - SourceLocation el(arg->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); - std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); - llvm::outs() << outs.c_str() << "\n"; - repName += " " + outs + ","; - } - repName.pop_back(); - repName += ")"; - size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(launchKernel->getLocEnd(), 0, *SM, DefaultLangOptions)) - - SM->getCharacterData(launchKernel->getLocStart()); - Replacement Rep(*SM, launchKernel->getLocStart(), length, repName); - Replace->insert(Rep); - } - - if (const MemberExpr * threadIdx = Result.Nodes.getNodeAs("cudaBuiltin")) - { - if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { - if (const DeclRefExpr * declRef = dyn_cast(refBase->getSourceExpr())) { - std::string name = declRef->getDecl()->getNameAsString(); - std::string memberName = threadIdx->getMemberDecl()->getNameAsString(); - size_t pos = memberName.find_first_not_of("__fetch_builtin_"); - memberName = memberName.substr(pos, memberName.length() - pos); + public: + Cuda2HipCallback(Replacements *Replace) : Replace(Replace) {} + + void run(const MatchFinder::MatchResult &Result) override { + + SourceManager * SM = Result.SourceManager; + + if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) + { + const FunctionDecl * funcDcl = call->getDirectCallee(); + std::string name = funcDcl->getDeclName().getAsString(); + if (N.cuda2hipRename.count(name)) { + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = call->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); + } + } + + if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) + { + LangOptions DefaultLangOptions; + StringRef initialParamList; + SmallString<40> XStr; + raw_svector_ostream OS(XStr); + OS << "hipLaunchParm lp"; + const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); + SourceLocation l1 = kernelDecl->getNameInfo().getLocStart(); + l1.dump(*SM);llvm::outs() << "\n"; + SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken(l1, clang::tok::l_paren, *SM, DefaultLangOptions, true); + kernelArgListStart.dump(*SM);llvm::outs() << "\n"; + size_t replacementLength = 0; + if (kernelDecl->getNumParams() > 0) { + //const ParmVarDecl * pvdFirst = kernelDecl->getParamDecl(0); + const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams()-1); + //kernelArgListStart = SourceLocation(pvdFirst->getLocStart()); + SourceLocation kernelArgListEnd = SourceLocation(pvdLast->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); + replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); + initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); + OS << ", " << initialParamList; + } + + llvm::outs() << "initial paramlist: " << initialParamList << "\n"; + llvm::outs() << "new paramlist: " << OS.str() << "\n"; + Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, OS.str()); + Replace->insert(Rep0); + + XStr.clear(); + OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << kernelDecl->getName() << "), "; + + const CallExpr * config = launchKernel->getConfig(); + llvm::outs() << "\nKernel config arguments:\n"; + for (unsigned argno = 0; argno < config->getNumArgs(); argno++) + { + const Expr * arg = config->getArg(argno); + if (!isa(arg)) { + const ParmVarDecl * pvd = config->getDirectCallee()->getParamDecl(argno); + + SourceLocation sl(arg->getLocStart()); + SourceLocation el(arg->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + StringRef outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + llvm::outs() << "args[ " << argno << "]" << outs << " <" << pvd->getType().getAsString() << ">\n"; + if (pvd->getType().getAsString().compare("dim3") == 0) + OS << " dim3(" << outs << "),"; + else + OS << " " << outs << ","; + } else + OS << " 0,"; + } + + for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) + { + const Expr * arg = launchKernel->getArg(argno); + SourceLocation sl(arg->getLocStart()); + SourceLocation el(arg->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + llvm::outs() << outs.c_str() << "\n"; + OS << " " << outs << ","; + } + XStr.pop_back(); + OS << ")"; + size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(launchKernel->getLocEnd(), 0, *SM, DefaultLangOptions)) - + SM->getCharacterData(launchKernel->getLocStart()); + Replacement Rep(*SM, launchKernel->getLocStart(), length, OS.str()); + Replace->insert(Rep); + } + + if (const MemberExpr * threadIdx = Result.Nodes.getNodeAs("cudaBuiltin")) + { + if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { + if (const DeclRefExpr * declRef = dyn_cast(refBase->getSourceExpr())) { + std::string name = declRef->getDecl()->getNameAsString(); + std::string memberName = threadIdx->getMemberDecl()->getNameAsString(); + size_t pos = memberName.find_first_not_of("__fetch_builtin_"); + memberName = memberName.substr(pos, memberName.length() - pos); name += "." + memberName; std::string repName = N.cuda2hipRename[name]; SourceLocation sl = threadIdx->getLocStart(); From 5e3ab927ad2dbc2a23a627053023a1352e071833 Mon Sep 17 00:00:00 2001 From: atimofee Date: Fri, 26 Feb 2016 23:35:27 +0300 Subject: [PATCH 14/82] =?UTF-8?q?1.CUDA=20structure=20types=20(and=20point?= =?UTF-8?q?ers=20to=20the=20types)=20in=20function=20parameter=20declarati?= =?UTF-8?q?on=20conversion=20=20=20=E2=80=93=20DONE.=202.Wrong=20source=20?= =?UTF-8?q?locations=20in=20qualified=20types=20declaration:=20=20?= =?UTF-8?q?=E2=80=93=20FIXED=203.cudaRuntimeGetVersion=20added=20to=20the?= =?UTF-8?q?=20names=20map=204.sizeof=20expression=20matcher=20added,=20exp?= =?UTF-8?q?ression=20handler=20is=20not=20yet=20ready=20-=20upcoming=20soo?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Cuda2Hip.cpp | 58 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 57df437e77..bb02357869 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -183,6 +183,7 @@ namespace { cuda2hipRename["cudaFuncSetCacheConfig"] = "hipFuncSetCacheConfig"; cuda2hipRename["cudaDriverGetVersion"] = "hipDriverGetVersion"; + cuda2hipRename["cudaRuntimeGetVersion"] = "hipRuntimeGetVersion"; // Peer2Peer cuda2hipRename["cudaDeviceCanAccessPeer"] = "hipDeviceCanAccessPeer"; @@ -341,9 +342,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { kernelArgListStart.dump(*SM);llvm::outs() << "\n"; size_t replacementLength = 0; if (kernelDecl->getNumParams() > 0) { - //const ParmVarDecl * pvdFirst = kernelDecl->getParamDecl(0); const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams()-1); - //kernelArgListStart = SourceLocation(pvdFirst->getLocStart()); SourceLocation kernelArgListEnd = SourceLocation(pvdLast->getLocEnd()); SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); @@ -441,22 +440,62 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { std::string name = cudaStructVar->getType()->getAsStructureType()->getDecl()->getNameAsString(); std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = cudaStructVar->getLocStart(); + TypeLoc TL = cudaStructVar->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); Replace->insert(Rep); } + if (const VarDecl * cudaStructVarPtr = Result.Nodes.getNodeAs("cudaStructVarPtr")) + { + const Type * t = cudaStructVarPtr->getType().getTypePtrOrNull(); + if (t) { + StringRef name = t->getPointeeCXXRecordDecl()->getName(); + StringRef repName = N.cuda2hipRename[name]; + TypeLoc TL = cudaStructVarPtr->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replace->insert(Rep); + } + } + + if (const ParmVarDecl * cudaParamDecl = Result.Nodes.getNodeAs("cudaParamDecl")) { - QualType QT = cudaParamDecl->getOriginalType(); - std::string name = QT.getAsString(); - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = cudaParamDecl->getLocStart(); + QualType QT = cudaParamDecl->getOriginalType().getUnqualifiedType(); + StringRef name = QT.getAsString(); + const Type * t = QT.getTypePtr(); + if (t->isStructureOrClassType()) { + name = t->getAsCXXRecordDecl()->getName(); + } + StringRef repName = N.cuda2hipRename[name]; + TypeLoc TL = cudaParamDecl->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); Replace->insert(Rep); } + + if (const ParmVarDecl * cudaParamDeclPtr = Result.Nodes.getNodeAs("cudaParamDeclPtr")) + { + const Type * pt = cudaParamDeclPtr->getType().getTypePtrOrNull(); + if (pt) { + QualType QT = pt->getPointeeType(); + const Type * t = QT.getTypePtr(); + StringRef name = t->isStructureOrClassType()? + t->getAsCXXRecordDecl()->getName() : StringRef(QT.getAsString()); + StringRef repName = N.cuda2hipRename[name]; + TypeLoc TL = cudaParamDeclPtr->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replace->insert(Rep); + } + } + + if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) { StringRef s = stringLiteral->getString(); @@ -530,7 +569,10 @@ int main(int argc, const char **argv) { Finder.addMatcher(declRefExpr(isExpansionInMainFile(), to(enumConstantDecl(matchesName("cuda.*")))).bind("cudaEnumConstantRef"), &Callback); Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(enumDecl(matchesName("cuda.*")))).bind("cudaEnumConstantDecl"), &Callback); Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(cxxRecordDecl(matchesName("cuda.*")))).bind("cudaStructVar"), &Callback); + Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(pointsTo(cxxRecordDecl(matchesName("cuda.*"))))).bind("cudaStructVarPtr"), &Callback); Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); + Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(pointsTo(namedDecl(matchesName("cuda.*"))))).bind("cudaParamDeclPtr"), &Callback); + Finder.addMatcher(expr(sizeOfExpr(hasArgumentOfType(recordType(hasDeclaration(cxxRecordDecl(matchesName("cuda.*"))))))).bind("cudaStructSizeOf"), &Callback); Finder.addMatcher(stringLiteral().bind("stringLiteral"), &Callback); auto action = newFrontendActionFactory(&Finder, &PPCallbacks); From 432500056a8b8af01910001d884569d4660bb950 Mon Sep 17 00:00:00 2001 From: atimofee Date: Mon, 29 Feb 2016 20:27:38 +0300 Subject: [PATCH 15/82] CUDA type names in sizeof() expression conversion added --- src/Cuda2Hip.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index bb02357869..c86a80bfb7 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -517,6 +517,20 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { begin = end + 1; } } + + if (const UnaryExprOrTypeTraitExpr * expr = Result.Nodes.getNodeAs("cudaStructSizeOf")) + { + TypeSourceInfo * typeInfo = expr->getArgumentTypeInfo(); + QualType QT = typeInfo->getType().getUnqualifiedType(); + const Type * type = QT.getTypePtr(); + StringRef name = type->getAsCXXRecordDecl()->getName(); + StringRef repName = N.cuda2hipRename[name]; + TypeLoc TL = typeInfo->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replace->insert(Rep); + } } private: From 0ca4ca8ba1ed597f88ecb7fc20344c75f09dcc5e Mon Sep 17 00:00:00 2001 From: dfukalov Date: Tue, 1 Mar 2016 18:15:54 +0300 Subject: [PATCH 16/82] Fix hipify tool discovery in lit test for standalone build case --- test/CMakeLists.txt | 4 ++-- test/lit.cfg | 1 + test/lit.site.cfg.in | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4f74091b0b..5a0250381d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,7 +6,7 @@ if( NOT PYTHONINTERP_FOUND ) "Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") endif() -set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) +set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/.. ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in @@ -16,7 +16,7 @@ configure_file( add_lit_testsuite(check-hipify "Running HIPify regression tests" ${CMAKE_CURRENT_SOURCE_DIR} PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg - DEPENDS hipify + DEPENDS hipify FileCheck lit ) add_custom_target(check) diff --git a/test/lit.cfg b/test/lit.cfg index 775cdbf0d4..d9606b48fc 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -51,4 +51,5 @@ if not tool_path: lit_config.note('Did not find ' + tool_name + ' in ' + llvm_tools_dir) tool_path = llvm_tools_dir + '/' + tool_name config.substitutions.append((tool_name, tool_path)) +config.substitutions.append(("hipify", obj_root+"/hipify")) diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 6fc35440d4..4511316ac7 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -1,7 +1,7 @@ import sys config.llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@" -config.obj_root = "@CMAKE_CURRENT_BINARY_DIR@" +config.obj_root = "@BINARY_DIR@" # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. From 5a595e2f46e424393a6005e4d939bfeba774ab1e Mon Sep 17 00:00:00 2001 From: dfukalov Date: Tue, 1 Mar 2016 19:46:55 +0300 Subject: [PATCH 17/82] minor spaces cleanup --- CMakeLists.txt | 3 +- src/Cuda2Hip.cpp | 246 +++++++++++++++++++++++------------------------ 2 files changed, 124 insertions(+), 125 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a6bc3636d..3348056faf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,9 +14,8 @@ if(${HIPIFY_STANDLONE}) include_directories(${LLVM_INCLUDE_DIRS}) link_directories(${LLVM_LIBRARY_DIRS}) add_definitions(${LLVM_DEFINITIONS}) - add_llvm_executable( hipify src/Cuda2Hip.cpp ) + add_llvm_executable(hipify src/Cuda2Hip.cpp ) find_program(LIT_COMMAND lit) - else() set(LLVM_LINK_COMPONENTS Option diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index c86a80bfb7..253a870c5c 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -157,7 +157,7 @@ namespace { cuda2hipRename["cudaStreamDefault"] = "hipStreamDefault"; cuda2hipRename["cudaStreamNonBlocking"] = "hipStreamNonBlocking"; - // Other synchronization + // Other synchronization cuda2hipRename["cudaDeviceSynchronize"] = "hipDeviceSynchronize"; cuda2hipRename["cudaThreadSynchronize"] = "hipDeviceSynchronize"; // translate deprecated cudaThreadSynchronize cuda2hipRename["cudaDeviceReset"] = "hipDeviceReset"; @@ -165,7 +165,7 @@ namespace { cuda2hipRename["cudaSetDevice"] = "hipSetDevice"; cuda2hipRename["cudaGetDevice"] = "hipGetDevice"; - // Device + // Device cuda2hipRename["cudaDeviceProp"] = "hipDeviceProp_t"; cuda2hipRename["cudaGetDeviceProperties"] = "hipDeviceGetProperties"; @@ -292,11 +292,11 @@ namespace { } } - void EndOfMainFile() override - { - + void EndOfMainFile() override + { + } - + bool SeenEnd; void setSourceManager(SourceManager * sm) { _sm = sm; } @@ -308,103 +308,103 @@ namespace { }; class Cuda2HipCallback : public MatchFinder::MatchCallback { - public: + public: Cuda2HipCallback(Replacements *Replace) : Replace(Replace) {} - + void run(const MatchFinder::MatchResult &Result) override { - - SourceManager * SM = Result.SourceManager; - - if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) - { - const FunctionDecl * funcDcl = call->getDirectCallee(); - std::string name = funcDcl->getDeclName().getAsString(); - if (N.cuda2hipRename.count(name)) { - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = call->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); - Replace->insert(Rep); - } - } - - if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) - { - LangOptions DefaultLangOptions; - StringRef initialParamList; - SmallString<40> XStr; - raw_svector_ostream OS(XStr); - OS << "hipLaunchParm lp"; - const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); - SourceLocation l1 = kernelDecl->getNameInfo().getLocStart(); - l1.dump(*SM);llvm::outs() << "\n"; - SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken(l1, clang::tok::l_paren, *SM, DefaultLangOptions, true); - kernelArgListStart.dump(*SM);llvm::outs() << "\n"; - size_t replacementLength = 0; - if (kernelDecl->getNumParams() > 0) { - const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams()-1); - SourceLocation kernelArgListEnd = SourceLocation(pvdLast->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); - replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); - initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); - OS << ", " << initialParamList; - } - - llvm::outs() << "initial paramlist: " << initialParamList << "\n"; - llvm::outs() << "new paramlist: " << OS.str() << "\n"; - Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, OS.str()); - Replace->insert(Rep0); - - XStr.clear(); - OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << kernelDecl->getName() << "), "; - - const CallExpr * config = launchKernel->getConfig(); - llvm::outs() << "\nKernel config arguments:\n"; - for (unsigned argno = 0; argno < config->getNumArgs(); argno++) - { - const Expr * arg = config->getArg(argno); - if (!isa(arg)) { - const ParmVarDecl * pvd = config->getDirectCallee()->getParamDecl(argno); - - SourceLocation sl(arg->getLocStart()); - SourceLocation el(arg->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); - StringRef outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); - llvm::outs() << "args[ " << argno << "]" << outs << " <" << pvd->getType().getAsString() << ">\n"; - if (pvd->getType().getAsString().compare("dim3") == 0) - OS << " dim3(" << outs << "),"; - else - OS << " " << outs << ","; - } else - OS << " 0,"; - } - - for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) - { - const Expr * arg = launchKernel->getArg(argno); - SourceLocation sl(arg->getLocStart()); - SourceLocation el(arg->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); - std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); - llvm::outs() << outs.c_str() << "\n"; - OS << " " << outs << ","; - } - XStr.pop_back(); - OS << ")"; - size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(launchKernel->getLocEnd(), 0, *SM, DefaultLangOptions)) - - SM->getCharacterData(launchKernel->getLocStart()); - Replacement Rep(*SM, launchKernel->getLocStart(), length, OS.str()); - Replace->insert(Rep); - } - - if (const MemberExpr * threadIdx = Result.Nodes.getNodeAs("cudaBuiltin")) - { - if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { - if (const DeclRefExpr * declRef = dyn_cast(refBase->getSourceExpr())) { - std::string name = declRef->getDecl()->getNameAsString(); - std::string memberName = threadIdx->getMemberDecl()->getNameAsString(); - size_t pos = memberName.find_first_not_of("__fetch_builtin_"); - memberName = memberName.substr(pos, memberName.length() - pos); + + SourceManager * SM = Result.SourceManager; + + if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) + { + const FunctionDecl * funcDcl = call->getDirectCallee(); + std::string name = funcDcl->getDeclName().getAsString(); + if (N.cuda2hipRename.count(name)) { + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = call->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); + } + } + + if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) + { + LangOptions DefaultLangOptions; + StringRef initialParamList; + SmallString<40> XStr; + raw_svector_ostream OS(XStr); + OS << "hipLaunchParm lp"; + const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); + SourceLocation l1 = kernelDecl->getNameInfo().getLocStart(); + l1.dump(*SM);llvm::outs() << "\n"; + SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken(l1, clang::tok::l_paren, *SM, DefaultLangOptions, true); + kernelArgListStart.dump(*SM);llvm::outs() << "\n"; + size_t replacementLength = 0; + if (kernelDecl->getNumParams() > 0) { + const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams()-1); + SourceLocation kernelArgListEnd = SourceLocation(pvdLast->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); + replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); + initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); + OS << ", " << initialParamList; + } + + llvm::outs() << "initial paramlist: " << initialParamList << "\n"; + llvm::outs() << "new paramlist: " << OS.str() << "\n"; + Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, OS.str()); + Replace->insert(Rep0); + + XStr.clear(); + OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << kernelDecl->getName() << "), "; + + const CallExpr * config = launchKernel->getConfig(); + llvm::outs() << "\nKernel config arguments:\n"; + for (unsigned argno = 0; argno < config->getNumArgs(); argno++) + { + const Expr * arg = config->getArg(argno); + if (!isa(arg)) { + const ParmVarDecl * pvd = config->getDirectCallee()->getParamDecl(argno); + + SourceLocation sl(arg->getLocStart()); + SourceLocation el(arg->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + StringRef outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + llvm::outs() << "args[ " << argno << "]" << outs << " <" << pvd->getType().getAsString() << ">\n"; + if (pvd->getType().getAsString().compare("dim3") == 0) + OS << " dim3(" << outs << "),"; + else + OS << " " << outs << ","; + } else + OS << " 0,"; + } + + for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) + { + const Expr * arg = launchKernel->getArg(argno); + SourceLocation sl(arg->getLocStart()); + SourceLocation el(arg->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + llvm::outs() << outs.c_str() << "\n"; + OS << " " << outs << ","; + } + XStr.pop_back(); + OS << ")"; + size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(launchKernel->getLocEnd(), 0, *SM, DefaultLangOptions)) - + SM->getCharacterData(launchKernel->getLocStart()); + Replacement Rep(*SM, launchKernel->getLocStart(), length, OS.str()); + Replace->insert(Rep); + } + + if (const MemberExpr * threadIdx = Result.Nodes.getNodeAs("cudaBuiltin")) + { + if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { + if (const DeclRefExpr * declRef = dyn_cast(refBase->getSourceExpr())) { + std::string name = declRef->getDecl()->getNameAsString(); + std::string memberName = threadIdx->getMemberDecl()->getNameAsString(); + size_t pos = memberName.find_first_not_of("__fetch_builtin_"); + memberName = memberName.substr(pos, memberName.length() - pos); name += "." + memberName; std::string repName = N.cuda2hipRename[name]; SourceLocation sl = threadIdx->getLocStart(); @@ -498,24 +498,24 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) { - StringRef s = stringLiteral->getString(); - size_t begin = 0; - while ((begin = s.find("cuda", begin)) != StringRef::npos) { - const size_t end = s.find_first_of(" ", begin + 4); - StringRef name = s.slice(begin, end); - llvm::outs() << "\nToken: <" << name << "> found in string literal " << s << "\n"; - StringRef repName = N.cuda2hipRename[name]; - if (!repName.empty()) { - llvm::outs() << "\nWill be replaced with: <" << repName << "\n"; - SourceLocation sl = stringLiteral->getLocationOfByte(begin, *SM, - Result.Context->getLangOpts(), Result.Context->getTargetInfo()); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); - Replace->insert(Rep); - } - if (end == StringRef::npos) break; - begin = end + 1; - } + StringRef s = stringLiteral->getString(); + size_t begin = 0; + while ((begin = s.find("cuda", begin)) != StringRef::npos) { + const size_t end = s.find_first_of(" ", begin + 4); + StringRef name = s.slice(begin, end); + llvm::outs() << "\nToken: <" << name << "> found in string literal " << s << "\n"; + StringRef repName = N.cuda2hipRename[name]; + if (!repName.empty()) { + llvm::outs() << "\nWill be replaced with: <" << repName << "\n"; + SourceLocation sl = stringLiteral->getLocationOfByte(begin, *SM, + Result.Context->getLangOpts(), Result.Context->getTargetInfo()); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replace->insert(Rep); + } + if (end == StringRef::npos) break; + begin = end + 1; + } } if (const UnaryExprOrTypeTraitExpr * expr = Result.Nodes.getNodeAs("cudaStructSizeOf")) @@ -551,7 +551,7 @@ int main(int argc, const char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(); int Result; - + CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory, llvm::cl::Required); std::string dst = OutputFilename; std::vector fileSources = OptionsParser.getSourcePathList(); @@ -584,9 +584,9 @@ int main(int argc, const char **argv) { Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(enumDecl(matchesName("cuda.*")))).bind("cudaEnumConstantDecl"), &Callback); Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(cxxRecordDecl(matchesName("cuda.*")))).bind("cudaStructVar"), &Callback); Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(pointsTo(cxxRecordDecl(matchesName("cuda.*"))))).bind("cudaStructVarPtr"), &Callback); - Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); + Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(pointsTo(namedDecl(matchesName("cuda.*"))))).bind("cudaParamDeclPtr"), &Callback); - Finder.addMatcher(expr(sizeOfExpr(hasArgumentOfType(recordType(hasDeclaration(cxxRecordDecl(matchesName("cuda.*"))))))).bind("cudaStructSizeOf"), &Callback); + Finder.addMatcher(expr(sizeOfExpr(hasArgumentOfType(recordType(hasDeclaration(cxxRecordDecl(matchesName("cuda.*"))))))).bind("cudaStructSizeOf"), &Callback); Finder.addMatcher(stringLiteral().bind("stringLiteral"), &Callback); auto action = newFrontendActionFactory(&Finder, &PPCallbacks); @@ -605,7 +605,7 @@ int main(int argc, const char **argv) { Tool.clearArgumentsAdjusters(); } - + LangOptions DefaultLangOptions; IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts); From 739263d0b547997f31507eeeb019b70fe7bc0820 Mon Sep 17 00:00:00 2001 From: atimofee Date: Tue, 1 Mar 2016 21:42:30 +0300 Subject: [PATCH 18/82] Macro expansion processing refactoring - initial stage --- src/Cuda2Hip.cpp | 124 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 91 insertions(+), 33 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index c86a80bfb7..c2217c5bf0 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -42,6 +42,7 @@ THE SOFTWARE. #include "clang/Frontend/CompilerInstance.h" #include "clang/Lex/Preprocessor.h" #include "clang/Lex/PPCallbacks.h" +#include "clang/Lex/MacroArgs.h" #include #include @@ -222,7 +223,7 @@ namespace { struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { HipifyPPCallbacks(Replacements * R) - : SeenEnd(false), _sm(nullptr), Replace(R) + : SeenEnd(false), _sm(nullptr), _pp(nullptr), Replace(R) { } @@ -233,6 +234,7 @@ namespace { setSourceManager(&SM); PP.addPPCallbacks(std::unique_ptr(this)); PP.Retain(); + setPreprocessor(&PP); return true; } @@ -279,7 +281,8 @@ namespace { if (N.cuda2hipRename.count(name)) { StringRef repName = N.cuda2hipRename[name]; llvm::errs() << "\nIdentifier " << name - << " found in definition of macro " << MacroNameTok.getIdentifierInfo()->getName() << "\n"; + << " found in definition of macro " + << MacroNameTok.getIdentifierInfo()->getName() << "\n"; llvm::errs() << "\nwill be replaced with: " << repName << "\n"; SourceLocation sl = T.getLocation(); llvm::errs() << "\nSourceLocation: ";sl.dump(*_sm); @@ -292,6 +295,68 @@ namespace { } } + virtual void MacroExpands(const Token &MacroNameTok, + const MacroDefinition &MD, SourceRange Range, + const MacroArgs *Args) override + { + if (_sm->isWrittenInMainFile(Range.getBegin())) + { + for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); i++) + { + StringRef macroName = MacroNameTok.getIdentifierInfo()->getName(); + std::vector toks; + // Code below is a kind of stolen from 'MacroArgs::getPreExpArgument' + // to workaround the 'const' MacroArgs passed into this hook. + const Token * start = Args->getUnexpArgument(i); + size_t len = Args->getArgLength(start) + 1; + _pp->EnterTokenStream(ArrayRef(start,len), false); + do { + toks.push_back(Token()); + Token & tk = toks.back(); + _pp->Lex(tk); + } while (toks.back().isNot(tok::eof)); + _pp->RemoveTopOfLexerStack(); + // end of stolen code + for (auto tok : toks) { + if (tok.isAnyIdentifier()) + { + StringRef name = tok.getIdentifierInfo()->getName(); + if (N.cuda2hipRename.count(name)) { + StringRef repName = N.cuda2hipRename[name]; + llvm::errs() << "\nIdentifier " << name + << " found as an actual argument in expansion of macro " + << macroName << "\n"; + llvm::errs() << "\nwill be replaced with: " << repName << "\n"; + SourceLocation sl = tok.getLocation(); + Replacement Rep(*_sm, sl, name.size(), repName); + Replace->insert(Rep); + } + } + if (tok.is(tok::string_literal)) + { + StringRef s(tok.getLiteralData(), tok.getLength()); + size_t begin = 0; + while ((begin = s.find("cuda", begin)) != StringRef::npos) { + const size_t end = s.find_first_of(" ", begin + 4); + StringRef name = s.slice(begin, end); + llvm::outs() << "\nToken: <" << name << "> found in string literal '" + << s << "' as argument in expansion of macro '" << macroName << "'\n"; + StringRef repName = N.cuda2hipRename[name]; + if (!repName.empty()) { + llvm::outs() << "\nWill be replaced with: <" << repName << "\n"; + SourceLocation sl = tok.getLocation().getLocWithOffset(begin); + Replacement Rep(*_sm, sl, name.size(), repName); + Replace->insert(Rep); + } + if (end == StringRef::npos) break; + begin = end + 1; + } + } + } + } + } + } + void EndOfMainFile() override { @@ -299,10 +364,13 @@ namespace { bool SeenEnd; void setSourceManager(SourceManager * sm) { _sm = sm; } + void setPreprocessor (Preprocessor * pp) { _pp = pp; } private: SourceManager * _sm; + Preprocessor * _pp; + Replacements * Replace; struct hipName N; }; @@ -315,18 +383,17 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { SourceManager * SM = Result.SourceManager; - if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) - { - const FunctionDecl * funcDcl = call->getDirectCallee(); - std::string name = funcDcl->getDeclName().getAsString(); - if (N.cuda2hipRename.count(name)) { - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = call->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); - Replace->insert(Rep); - } - } + if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) + { + const FunctionDecl * funcDcl = call->getDirectCallee(); + std::string name = funcDcl->getDeclName().getAsString(); + if (N.cuda2hipRename.count(name)) { + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = call->getLocStart(); + Replacement Rep(*SM, sl, name.length(), repName); + Replace->insert(Rep); + } + } if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) { @@ -408,8 +475,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { name += "." + memberName; std::string repName = N.cuda2hipRename[name]; SourceLocation sl = threadIdx->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replacement Rep(*SM, sl, name.length(), repName); Replace->insert(Rep); } } @@ -420,8 +486,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { std::string name = cudaEnumConstantRef->getDecl()->getNameAsString(); std::string repName = N.cuda2hipRename[name]; SourceLocation sl = cudaEnumConstantRef->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replacement Rep(*SM, sl, name.length(), repName); Replace->insert(Rep); } @@ -430,8 +495,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { std::string name = cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); std::string repName = N.cuda2hipRename[name]; SourceLocation sl = cudaEnumConstantDecl->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replacement Rep(*SM, sl, name.length(), repName); Replace->insert(Rep); } @@ -442,8 +506,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { std::string repName = N.cuda2hipRename[name]; TypeLoc TL = cudaStructVar->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replacement Rep(*SM, sl, name.length(), repName); Replace->insert(Rep); } @@ -455,8 +518,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { StringRef repName = N.cuda2hipRename[name]; TypeLoc TL = cudaStructVarPtr->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } } @@ -473,8 +535,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { StringRef repName = N.cuda2hipRename[name]; TypeLoc TL = cudaParamDecl->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } @@ -489,8 +550,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { StringRef repName = N.cuda2hipRename[name]; TypeLoc TL = cudaParamDeclPtr->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } } @@ -509,8 +569,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { llvm::outs() << "\nWill be replaced with: <" << repName << "\n"; SourceLocation sl = stringLiteral->getLocationOfByte(begin, *SM, Result.Context->getLangOpts(), Result.Context->getTargetInfo()); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } if (end == StringRef::npos) break; @@ -524,11 +583,10 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { QualType QT = typeInfo->getType().getUnqualifiedType(); const Type * type = QT.getTypePtr(); StringRef name = type->getAsCXXRecordDecl()->getName(); - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name]; TypeLoc TL = typeInfo->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } } From f5fe77db4e5e4f19c8446d15073823e5e74249a2 Mon Sep 17 00:00:00 2001 From: atimofee Date: Wed, 2 Mar 2016 17:22:06 +0300 Subject: [PATCH 19/82] String literals processing unified --- src/Cuda2Hip.cpp | 60 ++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 1c4b812506..07529c8e2f 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -221,6 +221,31 @@ namespace { DenseMap cuda2hipRename; }; + StringRef unquoteStr(StringRef s) { + if (s.size() > 1 && s.front() == '"' && s.back() == '"') + return s.substr(1, s.size()-2); + return s; + } + + void processString(StringRef s, struct hipName & map, + Replacements * Replace, SourceManager & SM, SourceLocation start) + { + size_t begin = 0; + while ((begin = s.find("cuda", begin)) != StringRef::npos) { + const size_t end = s.find_first_of(" ", begin + 4); + StringRef name = s.slice(begin, end); + StringRef repName = map.cuda2hipRename[name]; + if (!repName.empty()) { + SourceLocation sl = start.getLocWithOffset(begin + 1); + Replacement Rep(SM, sl, name.size(), repName); + Replace->insert(Rep); + } + if (end == StringRef::npos) break; + begin = end + 1; + } + } + + struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { HipifyPPCallbacks(Replacements * R) : SeenEnd(false), _sm(nullptr), _pp(nullptr), Replace(R) @@ -335,22 +360,7 @@ namespace { if (tok.is(tok::string_literal)) { StringRef s(tok.getLiteralData(), tok.getLength()); - size_t begin = 0; - while ((begin = s.find("cuda", begin)) != StringRef::npos) { - const size_t end = s.find_first_of(" ", begin + 4); - StringRef name = s.slice(begin, end); - llvm::outs() << "\nToken: <" << name << "> found in string literal '" - << s << "' as argument in expansion of macro '" << macroName << "'\n"; - StringRef repName = N.cuda2hipRename[name]; - if (!repName.empty()) { - llvm::outs() << "\nWill be replaced with: <" << repName << "\n"; - SourceLocation sl = tok.getLocation().getLocWithOffset(begin); - Replacement Rep(*_sm, sl, name.size(), repName); - Replace->insert(Rep); - } - if (end == StringRef::npos) break; - begin = end + 1; - } + processString(unquoteStr(s), N, Replace, *_sm, tok.getLocation()); } } } @@ -560,23 +570,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) { StringRef s = stringLiteral->getString(); - size_t begin = 0; - while ((begin = s.find("cuda", begin)) != StringRef::npos) { - const size_t end = s.find_first_of(" ", begin + 4); - StringRef name = s.slice(begin, end); - llvm::outs() << "\nToken: <" << name << "> found in string literal " << s << "\n"; - StringRef repName = N.cuda2hipRename[name]; - if (!repName.empty()) { - llvm::outs() << "\nWill be replaced with: <" << repName << "\n"; - SourceLocation sl = stringLiteral->getLocationOfByte(begin, *SM, - Result.Context->getLangOpts(), Result.Context->getTargetInfo()); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); - Replace->insert(Rep); - } - if (end == StringRef::npos) break; - begin = end + 1; - } + processString(s, N, Replace, *SM, stringLiteral->getLocStart()); } if (const UnaryExprOrTypeTraitExpr * expr = Result.Nodes.getNodeAs("cudaStructSizeOf")) From 8cc98ae13167a7b4a59dd30c0e4308ae7c4ee825 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Wed, 2 Mar 2016 18:01:51 +0300 Subject: [PATCH 20/82] add FE option "-std=c++11" by default --- src/Cuda2Hip.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 1c4b812506..8b5b5c9d1e 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -299,17 +299,17 @@ namespace { const MacroDefinition &MD, SourceRange Range, const MacroArgs *Args) override { - if (_sm->isWrittenInMainFile(Range.getBegin())) + if (_sm->isWrittenInMainFile(Range.getBegin())) { for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); i++) { StringRef macroName = MacroNameTok.getIdentifierInfo()->getName(); std::vector toks; - // Code below is a kind of stolen from 'MacroArgs::getPreExpArgument' - // to workaround the 'const' MacroArgs passed into this hook. - const Token * start = Args->getUnexpArgument(i); - size_t len = Args->getArgLength(start) + 1; - _pp->EnterTokenStream(ArrayRef(start,len), false); + // Code below is a kind of stolen from 'MacroArgs::getPreExpArgument' + // to workaround the 'const' MacroArgs passed into this hook. + const Token * start = Args->getUnexpArgument(i); + size_t len = Args->getArgLength(start) + 1; + _pp->EnterTokenStream(ArrayRef(start,len), false); do { toks.push_back(Token()); Token & tk = toks.back(); @@ -657,10 +657,9 @@ int main(int argc, const char **argv) { for (auto Stage : compilationStages) { - Tool.appendArgumentsAdjuster(combineAdjusters( - getInsertArgumentAdjuster(Stage, ArgumentInsertPosition::BEGIN), - getClangSyntaxOnlyAdjuster())); - + Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster(Stage, ArgumentInsertPosition::BEGIN)); + Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster("-std=c++11")); + Tool.appendArgumentsAdjuster(getClangSyntaxOnlyAdjuster()); Result = Tool.run(action.get()); Tool.clearArgumentsAdjusters(); From 9440f60d6ec9957ab66eed3407fcb4d8822dee5b Mon Sep 17 00:00:00 2001 From: dfukalov Date: Wed, 2 Mar 2016 19:58:45 +0300 Subject: [PATCH 21/82] fixed line endings to unix format as in clang/llvm --- src/Cuda2Hip.cpp | 1384 +++++++++++++++++++++++----------------------- 1 file changed, 692 insertions(+), 692 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 28ae058754..42d3ca836f 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -1,692 +1,692 @@ -/* -Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ -/** - * @file Cuda2Hip.cpp - * - * This file is compiled and linked into clang based hipify tool. - */ -#include "clang/ASTMatchers/ASTMatchers.h" -#include "clang/ASTMatchers/ASTMatchFinder.h" -#include "clang/Basic/SourceManager.h" -#include "clang/Frontend/FrontendActions.h" -#include "clang/Lex/Lexer.h" -#include "clang/Tooling/CommonOptionsParser.h" -#include "clang/Tooling/Refactoring.h" -#include "clang/Tooling/Tooling.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/Signals.h" -#include "llvm/Support/Debug.h" -#include "clang/Frontend/TextDiagnosticPrinter.h" -#include "clang/Rewrite/Core/Rewriter.h" -#include "clang/Lex/MacroInfo.h" -#include "clang/Frontend/CompilerInstance.h" -#include "clang/Lex/Preprocessor.h" -#include "clang/Lex/PPCallbacks.h" -#include "clang/Lex/MacroArgs.h" - -#include -#include - -using namespace clang; -using namespace clang::ast_matchers; -using namespace clang::tooling; -using namespace llvm; - -#define DEBUG_TYPE "cuda2hip" - -namespace { - struct hipName { - hipName() { - // defines - cuda2hipRename["__CUDACC__"] = "__HIPCC__"; - - // includes - cuda2hipRename["cuda_runtime.h"] = "hip_runtime.h"; - cuda2hipRename["cuda_runtime_api.h"] = "hip_runtime_api.h"; - - // Error codes and return types: - cuda2hipRename["cudaError_t"] = "hipError_t"; - cuda2hipRename["cudaError"] = "hipError"; - cuda2hipRename["cudaSuccess"] = "hipSuccess"; - - cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; - cuda2hipRename["cudaErrorMemoryAllocation"] = "hipErrorMemoryAllocation"; - cuda2hipRename["cudaErrorMemoryFree"] = "hipErrorMemoryFree"; - cuda2hipRename["cudaErrorUnknownSymbol"] = "hipErrorUnknownSymbol"; - cuda2hipRename["cudaErrorOutOfResources"] = "hipErrorOutOfResources"; - cuda2hipRename["cudaErrorInvalidValue"] = "hipErrorInvalidValue"; - cuda2hipRename["cudaErrorInvalidResourceHandle"] = "hipErrorInvalidResourceHandle"; - cuda2hipRename["cudaErrorInvalidDevice"] = "hipErrorInvalidDevice"; - cuda2hipRename["cudaErrorNoDevice"] = "hipErrorNoDevice"; - cuda2hipRename["cudaErrorNotReady"] = "hipErrorNotReady"; - cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; - - // error APIs: - cuda2hipRename["cudaGetLastError"] = "hipGetLastError"; - cuda2hipRename["cudaPeekAtLastError"] = "hipPeekAtLastError"; - cuda2hipRename["cudaGetErrorName"] = "hipGetErrorName"; - cuda2hipRename["cudaGetErrorString"] = "hipGetErrorString"; - - // Memcpy - cuda2hipRename["cudaMemcpy"] = "hipMemcpy"; - cuda2hipRename["cudaMemcpyHostToHost"] = "hipMemcpyHostToHost"; - cuda2hipRename["cudaMemcpyHostToDevice"] = "hipMemcpyHostToDevice"; - cuda2hipRename["cudaMemcpyDeviceToHost"] = "hipMemcpyDeviceToHost"; - cuda2hipRename["cudaMemcpyDeviceToDevice"] = "hipMemcpyDeviceToDevice"; - cuda2hipRename["cudaMemcpyDefault"] = "hipMemcpyDefault"; - cuda2hipRename["cudaMemcpyToSymbol"] = "hipMemcpyToSymbol"; - cuda2hipRename["cudaMemset"] = "hipMemset"; - cuda2hipRename["cudaMemsetAsync"] = "hipMemsetAsync"; - cuda2hipRename["cudaMemcpyAsync"] = "hipMemcpyAsync"; - cuda2hipRename["cudaMemGetInfo"] = "hipMemGetInfo"; - cuda2hipRename["cudaMemcpyKind"] = "hipMemcpyKind"; - - // Memory management : - cuda2hipRename["cudaMalloc"] = "hipMalloc"; - cuda2hipRename["cudaMallocHost"] = "hipMallocHost"; - cuda2hipRename["cudaFree"] = "hipFree"; - cuda2hipRename["cudaFreeHost"] = "hipFreeHost"; - - // Coordinate Indexing and Dimensions: - cuda2hipRename["threadIdx.x"] = "hipThreadIdx_x"; - cuda2hipRename["threadIdx.y"] = "hipThreadIdx_y"; - cuda2hipRename["threadIdx.z"] = "hipThreadIdx_z"; - - cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; - cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; - cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; - - cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; - cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; - cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; - - cuda2hipRename["gridDim.x"] = "hipGridDim_x"; - cuda2hipRename["gridDim.y"] = "hipGridDim_y"; - cuda2hipRename["gridDim.z"] = "hipGridDim_z"; - - cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; - cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; - cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; - - cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; - cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; - cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; - - cuda2hipRename["gridDim.x"] = "hipGridDim_x"; - cuda2hipRename["gridDim.y"] = "hipGridDim_y"; - cuda2hipRename["gridDim.z"] = "hipGridDim_z"; - - - cuda2hipRename["warpSize"] = "hipWarpSize"; - - // Events - cuda2hipRename["cudaEvent_t"] = "hipEvent_t"; - cuda2hipRename["cudaEventCreate"] = "hipEventCreate"; - cuda2hipRename["cudaEventCreateWithFlags"] = "hipEventCreateWithFlags"; - cuda2hipRename["cudaEventDestroy"] = "hipEventDestroy"; - cuda2hipRename["cudaEventRecord"] = "hipEventRecord"; - cuda2hipRename["cudaEventElapsedTime"] = "hipEventElapsedTime"; - cuda2hipRename["cudaEventSynchronize"] = "hipEventSynchronize"; - - // Streams - cuda2hipRename["cudaStream_t"] = "hipStream_t"; - cuda2hipRename["cudaStreamCreate"] = "hipStreamCreate"; - cuda2hipRename["cudaStreamCreateWithFlags"] = "hipStreamCreateWithFlags"; - cuda2hipRename["cudaStreamDestroy"] = "hipStreamDestroy"; - cuda2hipRename["cudaStreamWaitEvent"] = "hipStreamWaitEven"; - cuda2hipRename["cudaStreamSynchronize"] = "hipStreamSynchronize"; - cuda2hipRename["cudaStreamDefault"] = "hipStreamDefault"; - cuda2hipRename["cudaStreamNonBlocking"] = "hipStreamNonBlocking"; - - // Other synchronization - cuda2hipRename["cudaDeviceSynchronize"] = "hipDeviceSynchronize"; - cuda2hipRename["cudaThreadSynchronize"] = "hipDeviceSynchronize"; // translate deprecated cudaThreadSynchronize - cuda2hipRename["cudaDeviceReset"] = "hipDeviceReset"; - cuda2hipRename["cudaThreadExit"] = "hipDeviceReset"; // translate deprecated cudaThreadExit - cuda2hipRename["cudaSetDevice"] = "hipSetDevice"; - cuda2hipRename["cudaGetDevice"] = "hipGetDevice"; - - // Device - cuda2hipRename["cudaDeviceProp"] = "hipDeviceProp_t"; - cuda2hipRename["cudaGetDeviceProperties"] = "hipDeviceGetProperties"; - - // Cache config - cuda2hipRename["cudaDeviceSetCacheConfig"] = "hipDeviceSetCacheConfig"; - cuda2hipRename["cudaThreadSetCacheConfig"] = "hipDeviceSetCacheConfig"; // translate deprecated - cuda2hipRename["cudaDeviceGetCacheConfig"] = "hipDeviceGetCacheConfig"; - cuda2hipRename["cudaThreadGetCacheConfig"] = "hipDeviceGetCacheConfig"; // translate deprecated - cuda2hipRename["cudaFuncCache"] = "hipFuncCache"; - cuda2hipRename["cudaFuncCachePreferNone"] = "hipFuncCachePreferNone"; - cuda2hipRename["cudaFuncCachePreferShared"] = "hipFuncCachePreferShared"; - cuda2hipRename["cudaFuncCachePreferL1"] = "hipFuncCachePreferL1"; - cuda2hipRename["cudaFuncCachePreferEqual"] = "hipFuncCachePreferEqual"; - // function - cuda2hipRename["cudaFuncSetCacheConfig"] = "hipFuncSetCacheConfig"; - - cuda2hipRename["cudaDriverGetVersion"] = "hipDriverGetVersion"; - cuda2hipRename["cudaRuntimeGetVersion"] = "hipRuntimeGetVersion"; - - // Peer2Peer - cuda2hipRename["cudaDeviceCanAccessPeer"] = "hipDeviceCanAccessPeer"; - cuda2hipRename["cudaDeviceDisablePeerAccess"] = "hipDeviceDisablePeerAccess"; - cuda2hipRename["cudaDeviceEnablePeerAccess"] = "hipDeviceEnablePeerAccess"; - cuda2hipRename["cudaMemcpyPeerAsync"] = "hipMemcpyPeerAsync"; - cuda2hipRename["cudaMemcpyPeer"] = "hipMemcpyPeer"; - - // Shared mem: - cuda2hipRename["cudaDeviceSetSharedMemConfig"] = "hipDeviceSetSharedMemConfig"; - cuda2hipRename["cudaThreadSetSharedMemConfig"] = "hipDeviceSetSharedMemConfig"; // translate deprecated - cuda2hipRename["cudaDeviceGetSharedMemConfig"] = "hipDeviceGetSharedMemConfig"; - cuda2hipRename["cudaThreadGetSharedMemConfig"] = "hipDeviceGetSharedMemConfig"; // translate deprecated - cuda2hipRename["cudaSharedMemConfig"] = "hipSharedMemConfig"; - cuda2hipRename["cudaSharedMemBankSizeDefault"] = "hipSharedMemBankSizeDefault"; - cuda2hipRename["cudaSharedMemBankSizeFourByte"] = "hipSharedMemBankSizeFourByte"; - cuda2hipRename["cudaSharedMemBankSizeEightByte"] = "hipSharedMemBankSizeEightByte"; - - cuda2hipRename["cudaGetDeviceCount"] = "hipGetDeviceCount"; - - // Profiler - //cuda2hipRename["cudaProfilerInitialize"] = "hipProfilerInitialize"; // see if these are called anywhere. - cuda2hipRename["cudaProfilerStart"] = "hipProfilerStart"; - cuda2hipRename["cudaProfilerStop"] = "hipProfilerStop"; - - cuda2hipRename["cudaChannelFormatDesc"] = "hipChannelFormatDesc"; - cuda2hipRename["cudaFilterModePoint"] = "hipFilterModePoint"; - cuda2hipRename["cudaReadModeElementType"] = "hipReadModeElementType"; - - cuda2hipRename["cudaCreateChannelDesc"] = "hipCreateChannelDesc"; - cuda2hipRename["cudaBindTexture"] = "hipBindTexture"; - cuda2hipRename["cudaUnbindTexture"] = "hipUnbindTexture"; - } - DenseMap cuda2hipRename; - }; - - StringRef unquoteStr(StringRef s) { - if (s.size() > 1 && s.front() == '"' && s.back() == '"') - return s.substr(1, s.size()-2); - return s; - } - - void processString(StringRef s, struct hipName & map, - Replacements * Replace, SourceManager & SM, SourceLocation start) - { - size_t begin = 0; - while ((begin = s.find("cuda", begin)) != StringRef::npos) { - const size_t end = s.find_first_of(" ", begin + 4); - StringRef name = s.slice(begin, end); - StringRef repName = map.cuda2hipRename[name]; - if (!repName.empty()) { - SourceLocation sl = start.getLocWithOffset(begin + 1); - Replacement Rep(SM, sl, name.size(), repName); - Replace->insert(Rep); - } - if (end == StringRef::npos) break; - begin = end + 1; - } - } - - - struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { - HipifyPPCallbacks(Replacements * R) - : SeenEnd(false), _sm(nullptr), _pp(nullptr), Replace(R) - { - } - - virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override - { - Preprocessor &PP = CI.getPreprocessor(); - SourceManager & SM = CI.getSourceManager(); - setSourceManager(&SM); - PP.addPPCallbacks(std::unique_ptr(this)); - PP.Retain(); - setPreprocessor(&PP); - return true; - } - - virtual void InclusionDirective( - SourceLocation hash_loc, - const Token &include_token, - StringRef file_name, - bool is_angled, - CharSourceRange filename_range, - const FileEntry *file, - StringRef search_path, - StringRef relative_path, - const clang::Module *imported) override - { - if (_sm->isWrittenInMainFile(hash_loc)) { - if (is_angled) { - if (N.cuda2hipRename.count(file_name)) { - std::string repName = N.cuda2hipRename[file_name]; - llvm::errs() << "\nInclude file found: " << file_name << "\n"; - llvm::errs() << "\nSourceLocation:"; filename_range.getBegin().dump(*_sm); - llvm::errs() << "\nWill be replaced with " << repName << "\n"; - SourceLocation sl = filename_range.getBegin(); - SourceLocation sle = filename_range.getEnd(); - const char* B = _sm->getCharacterData(sl); - const char* E = _sm->getCharacterData(sle); - repName = "<" + repName + ">"; - Replacement Rep(*_sm, sl, E - B, repName); - Replace->insert(Rep); - } - } - } - } - - virtual void MacroDefined(const Token &MacroNameTok, - const MacroDirective *MD) override - { - if (_sm->isWrittenInMainFile(MD->getLocation()) && - MD->getKind() == MacroDirective::MD_Define) - { - for (auto T : MD->getMacroInfo()->tokens()) - { - if (T.isAnyIdentifier()) { - StringRef name = T.getIdentifierInfo()->getName(); - if (N.cuda2hipRename.count(name)) { - StringRef repName = N.cuda2hipRename[name]; - llvm::errs() << "\nIdentifier " << name - << " found in definition of macro " - << MacroNameTok.getIdentifierInfo()->getName() << "\n"; - llvm::errs() << "\nwill be replaced with: " << repName << "\n"; - SourceLocation sl = T.getLocation(); - llvm::errs() << "\nSourceLocation: ";sl.dump(*_sm); - llvm::errs() << "\n"; - Replacement Rep(*_sm, sl, name.size(), repName); - Replace->insert(Rep); - } - } - } - } - } - - virtual void MacroExpands(const Token &MacroNameTok, - const MacroDefinition &MD, SourceRange Range, - const MacroArgs *Args) override - { - if (_sm->isWrittenInMainFile(Range.getBegin())) - { - for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); i++) - { - StringRef macroName = MacroNameTok.getIdentifierInfo()->getName(); - std::vector toks; - // Code below is a kind of stolen from 'MacroArgs::getPreExpArgument' - // to workaround the 'const' MacroArgs passed into this hook. - const Token * start = Args->getUnexpArgument(i); - size_t len = Args->getArgLength(start) + 1; - _pp->EnterTokenStream(ArrayRef(start,len), false); - do { - toks.push_back(Token()); - Token & tk = toks.back(); - _pp->Lex(tk); - } while (toks.back().isNot(tok::eof)); - _pp->RemoveTopOfLexerStack(); - // end of stolen code - for (auto tok : toks) { - if (tok.isAnyIdentifier()) - { - StringRef name = tok.getIdentifierInfo()->getName(); - if (N.cuda2hipRename.count(name)) { - StringRef repName = N.cuda2hipRename[name]; - llvm::errs() << "\nIdentifier " << name - << " found as an actual argument in expansion of macro " - << macroName << "\n"; - llvm::errs() << "\nwill be replaced with: " << repName << "\n"; - SourceLocation sl = tok.getLocation(); - Replacement Rep(*_sm, sl, name.size(), repName); - Replace->insert(Rep); - } - } - if (tok.is(tok::string_literal)) - { - StringRef s(tok.getLiteralData(), tok.getLength()); - processString(unquoteStr(s), N, Replace, *_sm, tok.getLocation()); - } - } - } - } - } - - void EndOfMainFile() override - { - - } - - bool SeenEnd; - void setSourceManager(SourceManager * sm) { _sm = sm; } - void setPreprocessor (Preprocessor * pp) { _pp = pp; } - - private: - - SourceManager * _sm; - Preprocessor * _pp; - - Replacements * Replace; - struct hipName N; - }; - -class Cuda2HipCallback : public MatchFinder::MatchCallback { - public: - Cuda2HipCallback(Replacements *Replace) : Replace(Replace) {} - - void run(const MatchFinder::MatchResult &Result) override { - - SourceManager * SM = Result.SourceManager; - - if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) - { - const FunctionDecl * funcDcl = call->getDirectCallee(); - std::string name = funcDcl->getDeclName().getAsString(); - if (N.cuda2hipRename.count(name)) { - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = call->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); - Replace->insert(Rep); - } - } - - if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) - { - LangOptions DefaultLangOptions; - StringRef initialParamList; - SmallString<40> XStr; - raw_svector_ostream OS(XStr); - OS << "hipLaunchParm lp"; - const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); - SourceLocation l1 = kernelDecl->getNameInfo().getLocStart(); - l1.dump(*SM);llvm::outs() << "\n"; - SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken(l1, clang::tok::l_paren, *SM, DefaultLangOptions, true); - kernelArgListStart.dump(*SM);llvm::outs() << "\n"; - size_t replacementLength = 0; - if (kernelDecl->getNumParams() > 0) { - const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams()-1); - SourceLocation kernelArgListEnd = SourceLocation(pvdLast->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); - replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); - initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); - OS << ", " << initialParamList; - } - - llvm::outs() << "initial paramlist: " << initialParamList << "\n"; - llvm::outs() << "new paramlist: " << OS.str() << "\n"; - Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, OS.str()); - Replace->insert(Rep0); - - XStr.clear(); - OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << kernelDecl->getName() << "), "; - - const CallExpr * config = launchKernel->getConfig(); - llvm::outs() << "\nKernel config arguments:\n"; - for (unsigned argno = 0; argno < config->getNumArgs(); argno++) - { - const Expr * arg = config->getArg(argno); - if (!isa(arg)) { - const ParmVarDecl * pvd = config->getDirectCallee()->getParamDecl(argno); - - SourceLocation sl(arg->getLocStart()); - SourceLocation el(arg->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); - StringRef outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); - llvm::outs() << "args[ " << argno << "]" << outs << " <" << pvd->getType().getAsString() << ">\n"; - if (pvd->getType().getAsString().compare("dim3") == 0) - OS << " dim3(" << outs << "),"; - else - OS << " " << outs << ","; - } else - OS << " 0,"; - } - - for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) - { - const Expr * arg = launchKernel->getArg(argno); - SourceLocation sl(arg->getLocStart()); - SourceLocation el(arg->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); - std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); - llvm::outs() << outs.c_str() << "\n"; - OS << " " << outs << ","; - } - XStr.pop_back(); - OS << ")"; - size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(launchKernel->getLocEnd(), 0, *SM, DefaultLangOptions)) - - SM->getCharacterData(launchKernel->getLocStart()); - Replacement Rep(*SM, launchKernel->getLocStart(), length, OS.str()); - Replace->insert(Rep); - } - - if (const MemberExpr * threadIdx = Result.Nodes.getNodeAs("cudaBuiltin")) - { - if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { - if (const DeclRefExpr * declRef = dyn_cast(refBase->getSourceExpr())) { - std::string name = declRef->getDecl()->getNameAsString(); - std::string memberName = threadIdx->getMemberDecl()->getNameAsString(); - size_t pos = memberName.find_first_not_of("__fetch_builtin_"); - memberName = memberName.substr(pos, memberName.length() - pos); - name += "." + memberName; - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = threadIdx->getLocStart(); - Replacement Rep(*SM, sl, name.length(), repName); - Replace->insert(Rep); - } - } - } - - if (const DeclRefExpr * cudaEnumConstantRef = Result.Nodes.getNodeAs("cudaEnumConstantRef")) - { - std::string name = cudaEnumConstantRef->getDecl()->getNameAsString(); - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = cudaEnumConstantRef->getLocStart(); - Replacement Rep(*SM, sl, name.length(), repName); - Replace->insert(Rep); - } - - if (const VarDecl * cudaEnumConstantDecl = Result.Nodes.getNodeAs("cudaEnumConstantDecl")) - { - std::string name = cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = cudaEnumConstantDecl->getLocStart(); - Replacement Rep(*SM, sl, name.length(), repName); - Replace->insert(Rep); - } - - if (const VarDecl * cudaStructVar = Result.Nodes.getNodeAs("cudaStructVar")) - { - std::string name = - cudaStructVar->getType()->getAsStructureType()->getDecl()->getNameAsString(); - std::string repName = N.cuda2hipRename[name]; - TypeLoc TL = cudaStructVar->getTypeSourceInfo()->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.length(), repName); - Replace->insert(Rep); - } - - if (const VarDecl * cudaStructVarPtr = Result.Nodes.getNodeAs("cudaStructVarPtr")) - { - const Type * t = cudaStructVarPtr->getType().getTypePtrOrNull(); - if (t) { - StringRef name = t->getPointeeCXXRecordDecl()->getName(); - StringRef repName = N.cuda2hipRename[name]; - TypeLoc TL = cudaStructVarPtr->getTypeSourceInfo()->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); - } - } - - - if (const ParmVarDecl * cudaParamDecl = Result.Nodes.getNodeAs("cudaParamDecl")) - { - QualType QT = cudaParamDecl->getOriginalType().getUnqualifiedType(); - StringRef name = QT.getAsString(); - const Type * t = QT.getTypePtr(); - if (t->isStructureOrClassType()) { - name = t->getAsCXXRecordDecl()->getName(); - } - StringRef repName = N.cuda2hipRename[name]; - TypeLoc TL = cudaParamDecl->getTypeSourceInfo()->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); - } - - if (const ParmVarDecl * cudaParamDeclPtr = Result.Nodes.getNodeAs("cudaParamDeclPtr")) - { - const Type * pt = cudaParamDeclPtr->getType().getTypePtrOrNull(); - if (pt) { - QualType QT = pt->getPointeeType(); - const Type * t = QT.getTypePtr(); - StringRef name = t->isStructureOrClassType()? - t->getAsCXXRecordDecl()->getName() : StringRef(QT.getAsString()); - StringRef repName = N.cuda2hipRename[name]; - TypeLoc TL = cudaParamDeclPtr->getTypeSourceInfo()->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); - } - } - - - if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) - { - StringRef s = stringLiteral->getString(); - processString(s, N, Replace, *SM, stringLiteral->getLocStart()); - } - - if (const UnaryExprOrTypeTraitExpr * expr = Result.Nodes.getNodeAs("cudaStructSizeOf")) - { - TypeSourceInfo * typeInfo = expr->getArgumentTypeInfo(); - QualType QT = typeInfo->getType().getUnqualifiedType(); - const Type * type = QT.getTypePtr(); - StringRef name = type->getAsCXXRecordDecl()->getName(); - StringRef repName = N.cuda2hipRename[name]; - TypeLoc TL = typeInfo->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); - } - } - - private: - Replacements *Replace; - struct hipName N; -}; - -} // end anonymous namespace - -// Set up the command line options -static cl::OptionCategory ToolTemplateCategory("CUDA to HIP source translator options"); -static cl::extrahelp MoreHelp( " specify the path of source file\n\n" ); -static cl::opt -OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::cat(ToolTemplateCategory)); - -int main(int argc, const char **argv) { - - llvm::sys::PrintStackTraceOnErrorSignal(); - - int Result; - - CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory, llvm::cl::Required); - std::string dst = OutputFilename; - std::vector fileSources = OptionsParser.getSourcePathList(); - if (dst.empty()) { - dst = fileSources[0]; - size_t pos = dst.find(".cu"); - if (pos != std::string::npos) { - dst = dst.substr(0, pos) + ".hip.cu"; - } else { - llvm::errs() << "Input .cu file was not specified.\n"; - return 1; - } - } else { - dst += ".cu"; - } - std::ifstream source(fileSources[0], std::ios::binary); - std::ofstream dest(dst, std::ios::binary); - dest << source.rdbuf(); - source.close(); - dest.close(); - - RefactoringTool Tool(OptionsParser.getCompilations(), dst); - ast_matchers::MatchFinder Finder; - Cuda2HipCallback Callback(&Tool.getReplacements()); - HipifyPPCallbacks PPCallbacks(&Tool.getReplacements()); - Finder.addMatcher(callExpr(isExpansionInMainFile(), callee(functionDecl(matchesName("cuda.*")))).bind("cudaCall"), &Callback); - Finder.addMatcher(cudaKernelCallExpr().bind("cudaLaunchKernel"), &Callback); - Finder.addMatcher(memberExpr(isExpansionInMainFile(), hasObjectExpression(hasType(cxxRecordDecl(matchesName("__cuda_builtin_"))))).bind("cudaBuiltin"), &Callback); - Finder.addMatcher(declRefExpr(isExpansionInMainFile(), to(enumConstantDecl(matchesName("cuda.*")))).bind("cudaEnumConstantRef"), &Callback); - Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(enumDecl(matchesName("cuda.*")))).bind("cudaEnumConstantDecl"), &Callback); - Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(cxxRecordDecl(matchesName("cuda.*")))).bind("cudaStructVar"), &Callback); - Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(pointsTo(cxxRecordDecl(matchesName("cuda.*"))))).bind("cudaStructVarPtr"), &Callback); - Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); - Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(pointsTo(namedDecl(matchesName("cuda.*"))))).bind("cudaParamDeclPtr"), &Callback); - Finder.addMatcher(expr(sizeOfExpr(hasArgumentOfType(recordType(hasDeclaration(cxxRecordDecl(matchesName("cuda.*"))))))).bind("cudaStructSizeOf"), &Callback); - Finder.addMatcher(stringLiteral().bind("stringLiteral"), &Callback); - - auto action = newFrontendActionFactory(&Finder, &PPCallbacks); - - std::vector compilationStages; - compilationStages.push_back("--cuda-host-only"); - compilationStages.push_back("--cuda-device-only"); - - for (auto Stage : compilationStages) - { - Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster(Stage, ArgumentInsertPosition::BEGIN)); - Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster("-std=c++11")); - Tool.appendArgumentsAdjuster(getClangSyntaxOnlyAdjuster()); - Result = Tool.run(action.get()); - - Tool.clearArgumentsAdjusters(); - } - - LangOptions DefaultLangOptions; - IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); - TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts); - DiagnosticsEngine Diagnostics( - IntrusiveRefCntPtr(new DiagnosticIDs()), - &*DiagOpts, &DiagnosticPrinter, false); - SourceManager Sources(Diagnostics, Tool.getFiles()); - - llvm::outs() << "Replacements collected by the tool:\n"; - for (auto &r : Tool.getReplacements()) { - llvm::outs() << r.toString() << "\n"; - } - - Rewriter Rewrite(Sources, DefaultLangOptions); - - if (!Tool.applyAllReplacements(Rewrite)) { - llvm::errs() << "Skipped some replacements.\n"; - } - - Result = Rewrite.overwriteChangedFiles(); - - - { - size_t pos = dst.find(".cu"); - if (pos != std::string::npos) - { - rename(dst.c_str(), dst.substr(0, pos).c_str()); - } - } - return Result; -} +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +/** + * @file Cuda2Hip.cpp + * + * This file is compiled and linked into clang based hipify tool. + */ +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/Basic/SourceManager.h" +#include "clang/Frontend/FrontendActions.h" +#include "clang/Lex/Lexer.h" +#include "clang/Tooling/CommonOptionsParser.h" +#include "clang/Tooling/Refactoring.h" +#include "clang/Tooling/Tooling.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/Signals.h" +#include "llvm/Support/Debug.h" +#include "clang/Frontend/TextDiagnosticPrinter.h" +#include "clang/Rewrite/Core/Rewriter.h" +#include "clang/Lex/MacroInfo.h" +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Lex/Preprocessor.h" +#include "clang/Lex/PPCallbacks.h" +#include "clang/Lex/MacroArgs.h" + +#include +#include + +using namespace clang; +using namespace clang::ast_matchers; +using namespace clang::tooling; +using namespace llvm; + +#define DEBUG_TYPE "cuda2hip" + +namespace { + struct hipName { + hipName() { + // defines + cuda2hipRename["__CUDACC__"] = "__HIPCC__"; + + // includes + cuda2hipRename["cuda_runtime.h"] = "hip_runtime.h"; + cuda2hipRename["cuda_runtime_api.h"] = "hip_runtime_api.h"; + + // Error codes and return types: + cuda2hipRename["cudaError_t"] = "hipError_t"; + cuda2hipRename["cudaError"] = "hipError"; + cuda2hipRename["cudaSuccess"] = "hipSuccess"; + + cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; + cuda2hipRename["cudaErrorMemoryAllocation"] = "hipErrorMemoryAllocation"; + cuda2hipRename["cudaErrorMemoryFree"] = "hipErrorMemoryFree"; + cuda2hipRename["cudaErrorUnknownSymbol"] = "hipErrorUnknownSymbol"; + cuda2hipRename["cudaErrorOutOfResources"] = "hipErrorOutOfResources"; + cuda2hipRename["cudaErrorInvalidValue"] = "hipErrorInvalidValue"; + cuda2hipRename["cudaErrorInvalidResourceHandle"] = "hipErrorInvalidResourceHandle"; + cuda2hipRename["cudaErrorInvalidDevice"] = "hipErrorInvalidDevice"; + cuda2hipRename["cudaErrorNoDevice"] = "hipErrorNoDevice"; + cuda2hipRename["cudaErrorNotReady"] = "hipErrorNotReady"; + cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; + + // error APIs: + cuda2hipRename["cudaGetLastError"] = "hipGetLastError"; + cuda2hipRename["cudaPeekAtLastError"] = "hipPeekAtLastError"; + cuda2hipRename["cudaGetErrorName"] = "hipGetErrorName"; + cuda2hipRename["cudaGetErrorString"] = "hipGetErrorString"; + + // Memcpy + cuda2hipRename["cudaMemcpy"] = "hipMemcpy"; + cuda2hipRename["cudaMemcpyHostToHost"] = "hipMemcpyHostToHost"; + cuda2hipRename["cudaMemcpyHostToDevice"] = "hipMemcpyHostToDevice"; + cuda2hipRename["cudaMemcpyDeviceToHost"] = "hipMemcpyDeviceToHost"; + cuda2hipRename["cudaMemcpyDeviceToDevice"] = "hipMemcpyDeviceToDevice"; + cuda2hipRename["cudaMemcpyDefault"] = "hipMemcpyDefault"; + cuda2hipRename["cudaMemcpyToSymbol"] = "hipMemcpyToSymbol"; + cuda2hipRename["cudaMemset"] = "hipMemset"; + cuda2hipRename["cudaMemsetAsync"] = "hipMemsetAsync"; + cuda2hipRename["cudaMemcpyAsync"] = "hipMemcpyAsync"; + cuda2hipRename["cudaMemGetInfo"] = "hipMemGetInfo"; + cuda2hipRename["cudaMemcpyKind"] = "hipMemcpyKind"; + + // Memory management : + cuda2hipRename["cudaMalloc"] = "hipMalloc"; + cuda2hipRename["cudaMallocHost"] = "hipMallocHost"; + cuda2hipRename["cudaFree"] = "hipFree"; + cuda2hipRename["cudaFreeHost"] = "hipFreeHost"; + + // Coordinate Indexing and Dimensions: + cuda2hipRename["threadIdx.x"] = "hipThreadIdx_x"; + cuda2hipRename["threadIdx.y"] = "hipThreadIdx_y"; + cuda2hipRename["threadIdx.z"] = "hipThreadIdx_z"; + + cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; + cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; + cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; + + cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; + cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; + cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; + + cuda2hipRename["gridDim.x"] = "hipGridDim_x"; + cuda2hipRename["gridDim.y"] = "hipGridDim_y"; + cuda2hipRename["gridDim.z"] = "hipGridDim_z"; + + cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; + cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; + cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; + + cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; + cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; + cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; + + cuda2hipRename["gridDim.x"] = "hipGridDim_x"; + cuda2hipRename["gridDim.y"] = "hipGridDim_y"; + cuda2hipRename["gridDim.z"] = "hipGridDim_z"; + + + cuda2hipRename["warpSize"] = "hipWarpSize"; + + // Events + cuda2hipRename["cudaEvent_t"] = "hipEvent_t"; + cuda2hipRename["cudaEventCreate"] = "hipEventCreate"; + cuda2hipRename["cudaEventCreateWithFlags"] = "hipEventCreateWithFlags"; + cuda2hipRename["cudaEventDestroy"] = "hipEventDestroy"; + cuda2hipRename["cudaEventRecord"] = "hipEventRecord"; + cuda2hipRename["cudaEventElapsedTime"] = "hipEventElapsedTime"; + cuda2hipRename["cudaEventSynchronize"] = "hipEventSynchronize"; + + // Streams + cuda2hipRename["cudaStream_t"] = "hipStream_t"; + cuda2hipRename["cudaStreamCreate"] = "hipStreamCreate"; + cuda2hipRename["cudaStreamCreateWithFlags"] = "hipStreamCreateWithFlags"; + cuda2hipRename["cudaStreamDestroy"] = "hipStreamDestroy"; + cuda2hipRename["cudaStreamWaitEvent"] = "hipStreamWaitEven"; + cuda2hipRename["cudaStreamSynchronize"] = "hipStreamSynchronize"; + cuda2hipRename["cudaStreamDefault"] = "hipStreamDefault"; + cuda2hipRename["cudaStreamNonBlocking"] = "hipStreamNonBlocking"; + + // Other synchronization + cuda2hipRename["cudaDeviceSynchronize"] = "hipDeviceSynchronize"; + cuda2hipRename["cudaThreadSynchronize"] = "hipDeviceSynchronize"; // translate deprecated cudaThreadSynchronize + cuda2hipRename["cudaDeviceReset"] = "hipDeviceReset"; + cuda2hipRename["cudaThreadExit"] = "hipDeviceReset"; // translate deprecated cudaThreadExit + cuda2hipRename["cudaSetDevice"] = "hipSetDevice"; + cuda2hipRename["cudaGetDevice"] = "hipGetDevice"; + + // Device + cuda2hipRename["cudaDeviceProp"] = "hipDeviceProp_t"; + cuda2hipRename["cudaGetDeviceProperties"] = "hipDeviceGetProperties"; + + // Cache config + cuda2hipRename["cudaDeviceSetCacheConfig"] = "hipDeviceSetCacheConfig"; + cuda2hipRename["cudaThreadSetCacheConfig"] = "hipDeviceSetCacheConfig"; // translate deprecated + cuda2hipRename["cudaDeviceGetCacheConfig"] = "hipDeviceGetCacheConfig"; + cuda2hipRename["cudaThreadGetCacheConfig"] = "hipDeviceGetCacheConfig"; // translate deprecated + cuda2hipRename["cudaFuncCache"] = "hipFuncCache"; + cuda2hipRename["cudaFuncCachePreferNone"] = "hipFuncCachePreferNone"; + cuda2hipRename["cudaFuncCachePreferShared"] = "hipFuncCachePreferShared"; + cuda2hipRename["cudaFuncCachePreferL1"] = "hipFuncCachePreferL1"; + cuda2hipRename["cudaFuncCachePreferEqual"] = "hipFuncCachePreferEqual"; + // function + cuda2hipRename["cudaFuncSetCacheConfig"] = "hipFuncSetCacheConfig"; + + cuda2hipRename["cudaDriverGetVersion"] = "hipDriverGetVersion"; + cuda2hipRename["cudaRuntimeGetVersion"] = "hipRuntimeGetVersion"; + + // Peer2Peer + cuda2hipRename["cudaDeviceCanAccessPeer"] = "hipDeviceCanAccessPeer"; + cuda2hipRename["cudaDeviceDisablePeerAccess"] = "hipDeviceDisablePeerAccess"; + cuda2hipRename["cudaDeviceEnablePeerAccess"] = "hipDeviceEnablePeerAccess"; + cuda2hipRename["cudaMemcpyPeerAsync"] = "hipMemcpyPeerAsync"; + cuda2hipRename["cudaMemcpyPeer"] = "hipMemcpyPeer"; + + // Shared mem: + cuda2hipRename["cudaDeviceSetSharedMemConfig"] = "hipDeviceSetSharedMemConfig"; + cuda2hipRename["cudaThreadSetSharedMemConfig"] = "hipDeviceSetSharedMemConfig"; // translate deprecated + cuda2hipRename["cudaDeviceGetSharedMemConfig"] = "hipDeviceGetSharedMemConfig"; + cuda2hipRename["cudaThreadGetSharedMemConfig"] = "hipDeviceGetSharedMemConfig"; // translate deprecated + cuda2hipRename["cudaSharedMemConfig"] = "hipSharedMemConfig"; + cuda2hipRename["cudaSharedMemBankSizeDefault"] = "hipSharedMemBankSizeDefault"; + cuda2hipRename["cudaSharedMemBankSizeFourByte"] = "hipSharedMemBankSizeFourByte"; + cuda2hipRename["cudaSharedMemBankSizeEightByte"] = "hipSharedMemBankSizeEightByte"; + + cuda2hipRename["cudaGetDeviceCount"] = "hipGetDeviceCount"; + + // Profiler + //cuda2hipRename["cudaProfilerInitialize"] = "hipProfilerInitialize"; // see if these are called anywhere. + cuda2hipRename["cudaProfilerStart"] = "hipProfilerStart"; + cuda2hipRename["cudaProfilerStop"] = "hipProfilerStop"; + + cuda2hipRename["cudaChannelFormatDesc"] = "hipChannelFormatDesc"; + cuda2hipRename["cudaFilterModePoint"] = "hipFilterModePoint"; + cuda2hipRename["cudaReadModeElementType"] = "hipReadModeElementType"; + + cuda2hipRename["cudaCreateChannelDesc"] = "hipCreateChannelDesc"; + cuda2hipRename["cudaBindTexture"] = "hipBindTexture"; + cuda2hipRename["cudaUnbindTexture"] = "hipUnbindTexture"; + } + DenseMap cuda2hipRename; + }; + + StringRef unquoteStr(StringRef s) { + if (s.size() > 1 && s.front() == '"' && s.back() == '"') + return s.substr(1, s.size()-2); + return s; + } + + void processString(StringRef s, struct hipName & map, + Replacements * Replace, SourceManager & SM, SourceLocation start) + { + size_t begin = 0; + while ((begin = s.find("cuda", begin)) != StringRef::npos) { + const size_t end = s.find_first_of(" ", begin + 4); + StringRef name = s.slice(begin, end); + StringRef repName = map.cuda2hipRename[name]; + if (!repName.empty()) { + SourceLocation sl = start.getLocWithOffset(begin + 1); + Replacement Rep(SM, sl, name.size(), repName); + Replace->insert(Rep); + } + if (end == StringRef::npos) break; + begin = end + 1; + } + } + + + struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { + HipifyPPCallbacks(Replacements * R) + : SeenEnd(false), _sm(nullptr), _pp(nullptr), Replace(R) + { + } + + virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override + { + Preprocessor &PP = CI.getPreprocessor(); + SourceManager & SM = CI.getSourceManager(); + setSourceManager(&SM); + PP.addPPCallbacks(std::unique_ptr(this)); + PP.Retain(); + setPreprocessor(&PP); + return true; + } + + virtual void InclusionDirective( + SourceLocation hash_loc, + const Token &include_token, + StringRef file_name, + bool is_angled, + CharSourceRange filename_range, + const FileEntry *file, + StringRef search_path, + StringRef relative_path, + const clang::Module *imported) override + { + if (_sm->isWrittenInMainFile(hash_loc)) { + if (is_angled) { + if (N.cuda2hipRename.count(file_name)) { + std::string repName = N.cuda2hipRename[file_name]; + llvm::errs() << "\nInclude file found: " << file_name << "\n"; + llvm::errs() << "\nSourceLocation:"; filename_range.getBegin().dump(*_sm); + llvm::errs() << "\nWill be replaced with " << repName << "\n"; + SourceLocation sl = filename_range.getBegin(); + SourceLocation sle = filename_range.getEnd(); + const char* B = _sm->getCharacterData(sl); + const char* E = _sm->getCharacterData(sle); + repName = "<" + repName + ">"; + Replacement Rep(*_sm, sl, E - B, repName); + Replace->insert(Rep); + } + } + } + } + + virtual void MacroDefined(const Token &MacroNameTok, + const MacroDirective *MD) override + { + if (_sm->isWrittenInMainFile(MD->getLocation()) && + MD->getKind() == MacroDirective::MD_Define) + { + for (auto T : MD->getMacroInfo()->tokens()) + { + if (T.isAnyIdentifier()) { + StringRef name = T.getIdentifierInfo()->getName(); + if (N.cuda2hipRename.count(name)) { + StringRef repName = N.cuda2hipRename[name]; + llvm::errs() << "\nIdentifier " << name + << " found in definition of macro " + << MacroNameTok.getIdentifierInfo()->getName() << "\n"; + llvm::errs() << "\nwill be replaced with: " << repName << "\n"; + SourceLocation sl = T.getLocation(); + llvm::errs() << "\nSourceLocation: ";sl.dump(*_sm); + llvm::errs() << "\n"; + Replacement Rep(*_sm, sl, name.size(), repName); + Replace->insert(Rep); + } + } + } + } + } + + virtual void MacroExpands(const Token &MacroNameTok, + const MacroDefinition &MD, SourceRange Range, + const MacroArgs *Args) override + { + if (_sm->isWrittenInMainFile(Range.getBegin())) + { + for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); i++) + { + StringRef macroName = MacroNameTok.getIdentifierInfo()->getName(); + std::vector toks; + // Code below is a kind of stolen from 'MacroArgs::getPreExpArgument' + // to workaround the 'const' MacroArgs passed into this hook. + const Token * start = Args->getUnexpArgument(i); + size_t len = Args->getArgLength(start) + 1; + _pp->EnterTokenStream(ArrayRef(start,len), false); + do { + toks.push_back(Token()); + Token & tk = toks.back(); + _pp->Lex(tk); + } while (toks.back().isNot(tok::eof)); + _pp->RemoveTopOfLexerStack(); + // end of stolen code + for (auto tok : toks) { + if (tok.isAnyIdentifier()) + { + StringRef name = tok.getIdentifierInfo()->getName(); + if (N.cuda2hipRename.count(name)) { + StringRef repName = N.cuda2hipRename[name]; + llvm::errs() << "\nIdentifier " << name + << " found as an actual argument in expansion of macro " + << macroName << "\n"; + llvm::errs() << "\nwill be replaced with: " << repName << "\n"; + SourceLocation sl = tok.getLocation(); + Replacement Rep(*_sm, sl, name.size(), repName); + Replace->insert(Rep); + } + } + if (tok.is(tok::string_literal)) + { + StringRef s(tok.getLiteralData(), tok.getLength()); + processString(unquoteStr(s), N, Replace, *_sm, tok.getLocation()); + } + } + } + } + } + + void EndOfMainFile() override + { + + } + + bool SeenEnd; + void setSourceManager(SourceManager * sm) { _sm = sm; } + void setPreprocessor (Preprocessor * pp) { _pp = pp; } + + private: + + SourceManager * _sm; + Preprocessor * _pp; + + Replacements * Replace; + struct hipName N; + }; + +class Cuda2HipCallback : public MatchFinder::MatchCallback { + public: + Cuda2HipCallback(Replacements *Replace) : Replace(Replace) {} + + void run(const MatchFinder::MatchResult &Result) override { + + SourceManager * SM = Result.SourceManager; + + if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) + { + const FunctionDecl * funcDcl = call->getDirectCallee(); + std::string name = funcDcl->getDeclName().getAsString(); + if (N.cuda2hipRename.count(name)) { + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = call->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); + } + } + + if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) + { + LangOptions DefaultLangOptions; + StringRef initialParamList; + SmallString<40> XStr; + raw_svector_ostream OS(XStr); + OS << "hipLaunchParm lp"; + const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); + SourceLocation l1 = kernelDecl->getNameInfo().getLocStart(); + l1.dump(*SM);llvm::outs() << "\n"; + SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken(l1, clang::tok::l_paren, *SM, DefaultLangOptions, true); + kernelArgListStart.dump(*SM);llvm::outs() << "\n"; + size_t replacementLength = 0; + if (kernelDecl->getNumParams() > 0) { + const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams()-1); + SourceLocation kernelArgListEnd = SourceLocation(pvdLast->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); + replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); + initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); + OS << ", " << initialParamList; + } + + llvm::outs() << "initial paramlist: " << initialParamList << "\n"; + llvm::outs() << "new paramlist: " << OS.str() << "\n"; + Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, OS.str()); + Replace->insert(Rep0); + + XStr.clear(); + OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << kernelDecl->getName() << "), "; + + const CallExpr * config = launchKernel->getConfig(); + llvm::outs() << "\nKernel config arguments:\n"; + for (unsigned argno = 0; argno < config->getNumArgs(); argno++) + { + const Expr * arg = config->getArg(argno); + if (!isa(arg)) { + const ParmVarDecl * pvd = config->getDirectCallee()->getParamDecl(argno); + + SourceLocation sl(arg->getLocStart()); + SourceLocation el(arg->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + StringRef outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + llvm::outs() << "args[ " << argno << "]" << outs << " <" << pvd->getType().getAsString() << ">\n"; + if (pvd->getType().getAsString().compare("dim3") == 0) + OS << " dim3(" << outs << "),"; + else + OS << " " << outs << ","; + } else + OS << " 0,"; + } + + for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) + { + const Expr * arg = launchKernel->getArg(argno); + SourceLocation sl(arg->getLocStart()); + SourceLocation el(arg->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + llvm::outs() << outs.c_str() << "\n"; + OS << " " << outs << ","; + } + XStr.pop_back(); + OS << ")"; + size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(launchKernel->getLocEnd(), 0, *SM, DefaultLangOptions)) - + SM->getCharacterData(launchKernel->getLocStart()); + Replacement Rep(*SM, launchKernel->getLocStart(), length, OS.str()); + Replace->insert(Rep); + } + + if (const MemberExpr * threadIdx = Result.Nodes.getNodeAs("cudaBuiltin")) + { + if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { + if (const DeclRefExpr * declRef = dyn_cast(refBase->getSourceExpr())) { + std::string name = declRef->getDecl()->getNameAsString(); + std::string memberName = threadIdx->getMemberDecl()->getNameAsString(); + size_t pos = memberName.find_first_not_of("__fetch_builtin_"); + memberName = memberName.substr(pos, memberName.length() - pos); + name += "." + memberName; + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = threadIdx->getLocStart(); + Replacement Rep(*SM, sl, name.length(), repName); + Replace->insert(Rep); + } + } + } + + if (const DeclRefExpr * cudaEnumConstantRef = Result.Nodes.getNodeAs("cudaEnumConstantRef")) + { + std::string name = cudaEnumConstantRef->getDecl()->getNameAsString(); + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = cudaEnumConstantRef->getLocStart(); + Replacement Rep(*SM, sl, name.length(), repName); + Replace->insert(Rep); + } + + if (const VarDecl * cudaEnumConstantDecl = Result.Nodes.getNodeAs("cudaEnumConstantDecl")) + { + std::string name = cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = cudaEnumConstantDecl->getLocStart(); + Replacement Rep(*SM, sl, name.length(), repName); + Replace->insert(Rep); + } + + if (const VarDecl * cudaStructVar = Result.Nodes.getNodeAs("cudaStructVar")) + { + std::string name = + cudaStructVar->getType()->getAsStructureType()->getDecl()->getNameAsString(); + std::string repName = N.cuda2hipRename[name]; + TypeLoc TL = cudaStructVar->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.length(), repName); + Replace->insert(Rep); + } + + if (const VarDecl * cudaStructVarPtr = Result.Nodes.getNodeAs("cudaStructVarPtr")) + { + const Type * t = cudaStructVarPtr->getType().getTypePtrOrNull(); + if (t) { + StringRef name = t->getPointeeCXXRecordDecl()->getName(); + StringRef repName = N.cuda2hipRename[name]; + TypeLoc TL = cudaStructVarPtr->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } + } + + + if (const ParmVarDecl * cudaParamDecl = Result.Nodes.getNodeAs("cudaParamDecl")) + { + QualType QT = cudaParamDecl->getOriginalType().getUnqualifiedType(); + StringRef name = QT.getAsString(); + const Type * t = QT.getTypePtr(); + if (t->isStructureOrClassType()) { + name = t->getAsCXXRecordDecl()->getName(); + } + StringRef repName = N.cuda2hipRename[name]; + TypeLoc TL = cudaParamDecl->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } + + if (const ParmVarDecl * cudaParamDeclPtr = Result.Nodes.getNodeAs("cudaParamDeclPtr")) + { + const Type * pt = cudaParamDeclPtr->getType().getTypePtrOrNull(); + if (pt) { + QualType QT = pt->getPointeeType(); + const Type * t = QT.getTypePtr(); + StringRef name = t->isStructureOrClassType()? + t->getAsCXXRecordDecl()->getName() : StringRef(QT.getAsString()); + StringRef repName = N.cuda2hipRename[name]; + TypeLoc TL = cudaParamDeclPtr->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } + } + + + if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) + { + StringRef s = stringLiteral->getString(); + processString(s, N, Replace, *SM, stringLiteral->getLocStart()); + } + + if (const UnaryExprOrTypeTraitExpr * expr = Result.Nodes.getNodeAs("cudaStructSizeOf")) + { + TypeSourceInfo * typeInfo = expr->getArgumentTypeInfo(); + QualType QT = typeInfo->getType().getUnqualifiedType(); + const Type * type = QT.getTypePtr(); + StringRef name = type->getAsCXXRecordDecl()->getName(); + StringRef repName = N.cuda2hipRename[name]; + TypeLoc TL = typeInfo->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } + } + + private: + Replacements *Replace; + struct hipName N; +}; + +} // end anonymous namespace + +// Set up the command line options +static cl::OptionCategory ToolTemplateCategory("CUDA to HIP source translator options"); +static cl::extrahelp MoreHelp( " specify the path of source file\n\n" ); +static cl::opt +OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::cat(ToolTemplateCategory)); + +int main(int argc, const char **argv) { + + llvm::sys::PrintStackTraceOnErrorSignal(); + + int Result; + + CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory, llvm::cl::Required); + std::string dst = OutputFilename; + std::vector fileSources = OptionsParser.getSourcePathList(); + if (dst.empty()) { + dst = fileSources[0]; + size_t pos = dst.find(".cu"); + if (pos != std::string::npos) { + dst = dst.substr(0, pos) + ".hip.cu"; + } else { + llvm::errs() << "Input .cu file was not specified.\n"; + return 1; + } + } else { + dst += ".cu"; + } + std::ifstream source(fileSources[0], std::ios::binary); + std::ofstream dest(dst, std::ios::binary); + dest << source.rdbuf(); + source.close(); + dest.close(); + + RefactoringTool Tool(OptionsParser.getCompilations(), dst); + ast_matchers::MatchFinder Finder; + Cuda2HipCallback Callback(&Tool.getReplacements()); + HipifyPPCallbacks PPCallbacks(&Tool.getReplacements()); + Finder.addMatcher(callExpr(isExpansionInMainFile(), callee(functionDecl(matchesName("cuda.*")))).bind("cudaCall"), &Callback); + Finder.addMatcher(cudaKernelCallExpr().bind("cudaLaunchKernel"), &Callback); + Finder.addMatcher(memberExpr(isExpansionInMainFile(), hasObjectExpression(hasType(cxxRecordDecl(matchesName("__cuda_builtin_"))))).bind("cudaBuiltin"), &Callback); + Finder.addMatcher(declRefExpr(isExpansionInMainFile(), to(enumConstantDecl(matchesName("cuda.*")))).bind("cudaEnumConstantRef"), &Callback); + Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(enumDecl(matchesName("cuda.*")))).bind("cudaEnumConstantDecl"), &Callback); + Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(cxxRecordDecl(matchesName("cuda.*")))).bind("cudaStructVar"), &Callback); + Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(pointsTo(cxxRecordDecl(matchesName("cuda.*"))))).bind("cudaStructVarPtr"), &Callback); + Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); + Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(pointsTo(namedDecl(matchesName("cuda.*"))))).bind("cudaParamDeclPtr"), &Callback); + Finder.addMatcher(expr(sizeOfExpr(hasArgumentOfType(recordType(hasDeclaration(cxxRecordDecl(matchesName("cuda.*"))))))).bind("cudaStructSizeOf"), &Callback); + Finder.addMatcher(stringLiteral().bind("stringLiteral"), &Callback); + + auto action = newFrontendActionFactory(&Finder, &PPCallbacks); + + std::vector compilationStages; + compilationStages.push_back("--cuda-host-only"); + compilationStages.push_back("--cuda-device-only"); + + for (auto Stage : compilationStages) + { + Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster(Stage, ArgumentInsertPosition::BEGIN)); + Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster("-std=c++11")); + Tool.appendArgumentsAdjuster(getClangSyntaxOnlyAdjuster()); + Result = Tool.run(action.get()); + + Tool.clearArgumentsAdjusters(); + } + + LangOptions DefaultLangOptions; + IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); + TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts); + DiagnosticsEngine Diagnostics( + IntrusiveRefCntPtr(new DiagnosticIDs()), + &*DiagOpts, &DiagnosticPrinter, false); + SourceManager Sources(Diagnostics, Tool.getFiles()); + + llvm::outs() << "Replacements collected by the tool:\n"; + for (auto &r : Tool.getReplacements()) { + llvm::outs() << r.toString() << "\n"; + } + + Rewriter Rewrite(Sources, DefaultLangOptions); + + if (!Tool.applyAllReplacements(Rewrite)) { + llvm::errs() << "Skipped some replacements.\n"; + } + + Result = Rewrite.overwriteChangedFiles(); + + + { + size_t pos = dst.find(".cu"); + if (pos != std::string::npos) + { + rename(dst.c_str(), dst.substr(0, pos).c_str()); + } + } + return Result; +} From 8e9d0f8e05f43dae61f499cb2dd0c7b3a639a632 Mon Sep 17 00:00:00 2001 From: Daniil Fukalov Date: Wed, 2 Mar 2016 20:05:42 +0300 Subject: [PATCH 22/82] Update README.md --- README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a3725394ad..0ddd4f9b91 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,22 @@ # HIPIFY The CLANG-based HIPIFY tool - translates CUDA to [HIP](https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/blob/master/README.md) +# How to Build tool *in llvm source tree* +- get LLVM, CLANG and clang-tools-extra sources +- put hipify folder into llvm/tools/clang/tools/extra, add it to llvm/tools/clang/tools/extra/CMakeLists.txt +- run cmake and build tool +``` +git clone http://llvm.org/git/llvm.git llvm +git clone http://llvm.org/git/clang.git llvm/tools/clang +git clone http://llvm.org/git/clang-tools-extra.git llvm/tools/clang/tools/extra +git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git llvm/tools/clang/tools/extra/hipify +echo "add_subdirectory(hipify)" >> llvm/tools/clang/tools/extra/CMakeLists.txt + +mkdir llvm_build && cd llvm_build +cmake -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm +make +``` + # How to Build *standalone* tool - Get LLVM and CLANG sources, build them and install to a **LLVM_INSTALL_PATH** folder - mkdir for hipify, run cmake there and build the tool: @@ -18,22 +34,6 @@ cmake -DLLVM_DIR="LLVM_INSTALL_PATH" -DHIPIFY_STANDLONE=1 .. make ``` -# How to Build tool *in llvm source tree* -- get LLVM, CLANG and clang-tools-extra sources -- put hipify folder into llvm/tools/clang/tools/extra, add it to llvm/tools/clang/tools/extra/CMakeLists.txt -- run cmake and build tool -``` -git clone http://llvm.org/git/llvm.git llvm -git clone http://llvm.org/git/clang.git llvm/tools/clang -git clone http://llvm.org/git/clang-tools-extra.git llvm/tools/clang/tools/extra -git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git llvm/tools/clang/tools/extra/hipify -echo "add_subdirectory(hipify)" >> llvm/tools/clang/tools/extra/CMakeLists.txt - -mkdir llvm_build && cd llvm_build -cmake -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm -make -C tools/clang/tools/extra/hipify -``` - # How to run tests (for *standalone* tool only) - install Python and add python-setuptools - install lit python script From 9c3d1536e908fe258406b1504202b4b667add4be Mon Sep 17 00:00:00 2001 From: dfukalov Date: Thu, 3 Mar 2016 18:28:24 +0300 Subject: [PATCH 23/82] 1. fixed file extension search bug 2. added new dependency --- CMakeLists.txt | 1 + src/Cuda2Hip.cpp | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3348056faf..0c209b8fa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ target_link_libraries(hipify clangToolingCore clangRewrite clangBasic + LLVMProfileData LLVMSupport LLVMMCParser LLVMMC diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 42d3ca836f..129b47e63e 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -611,7 +611,7 @@ int main(int argc, const char **argv) { std::vector fileSources = OptionsParser.getSourcePathList(); if (dst.empty()) { dst = fileSources[0]; - size_t pos = dst.find(".cu"); + size_t pos = dst.rfind(".cu"); if (pos != std::string::npos) { dst = dst.substr(0, pos) + ".hip.cu"; } else { @@ -656,7 +656,7 @@ int main(int argc, const char **argv) { Tool.appendArgumentsAdjuster(getClangSyntaxOnlyAdjuster()); Result = Tool.run(action.get()); - Tool.clearArgumentsAdjusters(); + Tool.clearArgumentsAdjusters(); } LangOptions DefaultLangOptions; @@ -680,13 +680,10 @@ int main(int argc, const char **argv) { Result = Rewrite.overwriteChangedFiles(); - + size_t pos = dst.rfind(".cu"); + if (pos != std::string::npos) { - size_t pos = dst.find(".cu"); - if (pos != std::string::npos) - { - rename(dst.c_str(), dst.substr(0, pos).c_str()); - } + rename(dst.c_str(), dst.substr(0, pos).c_str()); } return Result; } From 3c0f30f21ca92356f319aa0e6938b9002494ac86 Mon Sep 17 00:00:00 2001 From: atimofee Date: Thu, 3 Mar 2016 19:36:52 +0300 Subject: [PATCH 24/82] Assert ("This function is used in places that assume strings use char") in stringLiteral::getString() FIXED --- src/Cuda2Hip.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 42d3ca836f..f27a1bc1e5 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -569,8 +569,10 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) { - StringRef s = stringLiteral->getString(); - processString(s, N, Replace, *SM, stringLiteral->getLocStart()); + if (stringLiteral->getCharByteWidth() == 1) { + StringRef s = stringLiteral->getString(); + processString(s, N, Replace, *SM, stringLiteral->getLocStart()); + } } if (const UnaryExprOrTypeTraitExpr * expr = Result.Nodes.getNodeAs("cudaStructSizeOf")) From 8b1643ffb563d918ac59f65f69b04b165b34f71a Mon Sep 17 00:00:00 2001 From: atimofee Date: Fri, 4 Mar 2016 22:07:41 +0300 Subject: [PATCH 25/82] Template kernels calls and declaration conversion added --- src/Cuda2Hip.cpp | 96 +++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index f2a18262a9..434d74e584 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -324,7 +324,7 @@ namespace { const MacroDefinition &MD, SourceRange Range, const MacroArgs *Args) override { - if (_sm->isWrittenInMainFile(Range.getBegin())) + if (_sm->isWrittenInMainFile(MacroNameTok.getLocation())) { for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); i++) { @@ -386,12 +386,43 @@ namespace { }; class Cuda2HipCallback : public MatchFinder::MatchCallback { - public: - Cuda2HipCallback(Replacements *Replace) : Replace(Replace) {} + public: + Cuda2HipCallback(Replacements *Replace, ast_matchers::MatchFinder *parent) + : Replace(Replace), owner(parent) {} - void run(const MatchFinder::MatchResult &Result) override { + void convertKernelDecl(const FunctionDecl * kernelDecl, const MatchFinder::MatchResult &Result) + { + SourceManager * SM = Result.SourceManager; + LangOptions DefaultLangOptions; - SourceManager * SM = Result.SourceManager; + SmallString<40> XStr; + raw_svector_ostream OS(XStr); + StringRef initialParamList; + OS << "hipLaunchParm lp"; + size_t replacementLength = OS.str().size(); + SourceLocation sl = kernelDecl->getNameInfo().getEndLoc(); + SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken(sl, clang::tok::l_paren, *SM, DefaultLangOptions, true); + kernelArgListStart.dump(*SM); + if (kernelDecl->getNumParams() > 0) { + const ParmVarDecl * pvdFirst = kernelDecl->getParamDecl(0); + const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams() - 1); + SourceLocation kernelArgListStart(pvdFirst->getLocStart()); + SourceLocation kernelArgListEnd(pvdLast->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); + size_t replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); + initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); + OS << ", " << initialParamList; + } + llvm::outs() << "initial paramlist: " << initialParamList << "\n"; + llvm::outs() << "new paramlist: " << OS.str() << "\n"; + Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, OS.str()); + Replace->insert(Rep0); + } + + void run(const MatchFinder::MatchResult &Result) override { + + SourceManager * SM = Result.SourceManager; + LangOptions DefaultLangOptions; if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) { @@ -406,35 +437,27 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { } } - if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) - { - LangOptions DefaultLangOptions; - StringRef initialParamList; - SmallString<40> XStr; - raw_svector_ostream OS(XStr); - OS << "hipLaunchParm lp"; - const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); - SourceLocation l1 = kernelDecl->getNameInfo().getLocStart(); - l1.dump(*SM);llvm::outs() << "\n"; - SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken(l1, clang::tok::l_paren, *SM, DefaultLangOptions, true); - kernelArgListStart.dump(*SM);llvm::outs() << "\n"; - size_t replacementLength = 0; - if (kernelDecl->getNumParams() > 0) { - const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams()-1); - SourceLocation kernelArgListEnd = SourceLocation(pvdLast->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); - replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); - initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); - OS << ", " << initialParamList; + if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) + { + SmallString<40> XStr; + raw_svector_ostream OS(XStr); + StringRef calleeName; + const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); + if (kernelDecl) { + calleeName = kernelDecl->getName(); + convertKernelDecl(kernelDecl, Result); + } + else { + const Expr * e = launchKernel->getCallee(); + if (const UnresolvedLookupExpr * ule = dyn_cast(e)) { + calleeName = ule->getName().getAsIdentifierInfo()->getName(); + owner->addMatcher(functionTemplateDecl(hasName(calleeName)).bind("unresolvedTemplateName"), this); } + } - llvm::outs() << "initial paramlist: " << initialParamList << "\n"; - llvm::outs() << "new paramlist: " << OS.str() << "\n"; - Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, OS.str()); - Replace->insert(Rep0); XStr.clear(); - OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << kernelDecl->getName() << "), "; + OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << calleeName << "), "; const CallExpr * config = launchKernel->getConfig(); llvm::outs() << "\nKernel config arguments:\n"; @@ -475,6 +498,12 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { Replace->insert(Rep); } + if (const FunctionTemplateDecl * templateDecl = Result.Nodes.getNodeAs("unresolvedTemplateName")) + { + FunctionDecl * kernelDecl = templateDecl->getTemplatedDecl(); + convertKernelDecl(kernelDecl, Result); + } + if (const MemberExpr * threadIdx = Result.Nodes.getNodeAs("cudaBuiltin")) { if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { @@ -591,6 +620,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { private: Replacements *Replace; + ast_matchers::MatchFinder * owner; struct hipName N; }; @@ -631,7 +661,7 @@ int main(int argc, const char **argv) { RefactoringTool Tool(OptionsParser.getCompilations(), dst); ast_matchers::MatchFinder Finder; - Cuda2HipCallback Callback(&Tool.getReplacements()); + Cuda2HipCallback Callback(&Tool.getReplacements(), &Finder); HipifyPPCallbacks PPCallbacks(&Tool.getReplacements()); Finder.addMatcher(callExpr(isExpansionInMainFile(), callee(functionDecl(matchesName("cuda.*")))).bind("cudaCall"), &Callback); Finder.addMatcher(cudaKernelCallExpr().bind("cudaLaunchKernel"), &Callback); @@ -642,8 +672,8 @@ int main(int argc, const char **argv) { Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(pointsTo(cxxRecordDecl(matchesName("cuda.*"))))).bind("cudaStructVarPtr"), &Callback); Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(pointsTo(namedDecl(matchesName("cuda.*"))))).bind("cudaParamDeclPtr"), &Callback); - Finder.addMatcher(expr(sizeOfExpr(hasArgumentOfType(recordType(hasDeclaration(cxxRecordDecl(matchesName("cuda.*"))))))).bind("cudaStructSizeOf"), &Callback); - Finder.addMatcher(stringLiteral().bind("stringLiteral"), &Callback); + Finder.addMatcher(expr(isExpansionInMainFile(), sizeOfExpr(hasArgumentOfType(recordType(hasDeclaration(cxxRecordDecl(matchesName("cuda.*"))))))).bind("cudaStructSizeOf"), &Callback); + Finder.addMatcher(stringLiteral(isExpansionInMainFile()).bind("stringLiteral"), &Callback); auto action = newFrontendActionFactory(&Finder, &PPCallbacks); From 41267688d0e9de8c598cf1f95f3d6a357dc2ad5e Mon Sep 17 00:00:00 2001 From: dfukalov Date: Sat, 5 Mar 2016 13:59:38 +0300 Subject: [PATCH 26/82] 1. added double dash option to test to avoid warning message about compilation database 2. fixed cmake resource folder discovery for standalone build case --- CMakeLists.txt | 1 + src/Cuda2Hip.cpp | 3 +++ test/axpy.cu | 23 ++++++++++------------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c209b8fa2..18e8e7df4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,7 @@ if(${HIPIFY_STANDLONE}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fno-rtti -fvisibility-inlines-hidden") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\"") add_subdirectory(test) else() install(TARGETS hipify diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 434d74e584..a9cb162849 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -685,6 +685,9 @@ int main(int argc, const char **argv) { { Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster(Stage, ArgumentInsertPosition::BEGIN)); Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster("-std=c++11")); +#if defined(HIPIFY_CLANG_RES) + Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster("-resource-dir=" HIPIFY_CLANG_RES)); +#endif // defined(HIPIFY_CLANG_HEADERS) Tool.appendArgumentsAdjuster(getClangSyntaxOnlyAdjuster()); Result = Tool.run(action.get()); diff --git a/test/axpy.cu b/test/axpy.cu index 29d5493763..9e83ccb7e6 100644 --- a/test/axpy.cu +++ b/test/axpy.cu @@ -1,11 +1,10 @@ -// RUN: hipify "%s" 2>&1 | FileCheck %s - -#include // for checkCudaErrors +// RUN: hipify "%s" -o=%t -- +// RUN: FileCheck %s -input-file=%t --match-full-lines #include __global__ void axpy(float a, float* x, float* y) { - // CHECK: hipThreadIdx_x + // CHECK: y[hipThreadIdx_x] = a * x[hipThreadIdx_x]; y[threadIdx.x] = a * x[threadIdx.x]; } @@ -19,25 +18,23 @@ int main(int argc, char* argv[]) { // Copy input data to device. float* device_x; float* device_y; - checkCudaErrors(cudaMalloc(&device_x, kDataLen * sizeof(float))); - checkCudaErrors(cudaMalloc(&device_y, kDataLen * sizeof(float))); - checkCudaErrors(cudaMemcpy(device_x, host_x, kDataLen * sizeof(float), - cudaMemcpyHostToDevice)); + cudaMalloc(&device_x, kDataLen * sizeof(float)); + cudaMalloc(&device_y, kDataLen * sizeof(float)); + cudaMemcpy(device_x, host_x, kDataLen * sizeof(float), cudaMemcpyHostToDevice); // Launch the kernel. - // CHECK: hipLaunchKernel(HIP_KERNEL_NAME + // CHECK: hipLaunchKernel(HIP_KERNEL_NAME(axpy), dim3(1), dim3(kDataLen), 0, 0, a, device_x, device_y); axpy<<<1, kDataLen>>>(a, device_x, device_y); // Copy output data to host. - checkCudaErrors(cudaDeviceSynchronize()); - checkCudaErrors(cudaMemcpy(host_y, device_y, kDataLen * sizeof(float), - cudaMemcpyDeviceToHost)); + cudaDeviceSynchronize(); + cudaMemcpy(host_y, device_y, kDataLen * sizeof(float), cudaMemcpyDeviceToHost); // Print the results. for (int i = 0; i < kDataLen; ++i) { std::cout << "y[" << i << "] = " << host_y[i] << "\n"; } - checkCudaErrors(cudaDeviceReset()); + cudaDeviceReset(); return 0; } From 437f4d0a48f158cc9cf99e8ca375dcaec1bdbd1f Mon Sep 17 00:00:00 2001 From: dfukalov Date: Mon, 7 Mar 2016 21:29:23 +0300 Subject: [PATCH 27/82] added -inplace option --- src/Cuda2Hip.cpp | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index a9cb162849..cfc7c02446 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -629,9 +629,14 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { // Set up the command line options static cl::OptionCategory ToolTemplateCategory("CUDA to HIP source translator options"); static cl::extrahelp MoreHelp( " specify the path of source file\n\n" ); + static cl::opt OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::cat(ToolTemplateCategory)); +static cl::opt +Inplace("inplace", cl::desc("Modify input file inplace, replacing input with hipified output, save backup in .prehip file. " + "If .prehip file exists, use that as input to hip."), cl::value_desc("inplace"), cl::cat(ToolTemplateCategory)); + int main(int argc, const char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(); @@ -643,18 +648,24 @@ int main(int argc, const char **argv) { std::vector fileSources = OptionsParser.getSourcePathList(); if (dst.empty()) { dst = fileSources[0]; - size_t pos = dst.rfind(".cu"); - if (pos != std::string::npos) { - dst = dst.substr(0, pos) + ".hip.cu"; - } else { - llvm::errs() << "Input .cu file was not specified.\n"; - return 1; + if (!Inplace) { + size_t pos = dst.rfind(".cu"); + if (pos != std::string::npos) { + dst = dst.substr(0, pos) + ".hip.cu"; + } else { + llvm::errs() << "Input .cu file was not specified.\n"; + return 1; + } } } else { + if (Inplace) { + llvm::errs() << "Conflict: both -o and -inplace options are specified."; + } dst += ".cu"; } + std::ifstream source(fileSources[0], std::ios::binary); - std::ofstream dest(dst, std::ios::binary); + std::ofstream dest(Inplace ? dst+".prehip" : dst, std::ios::binary); dest << source.rdbuf(); source.close(); dest.close(); @@ -715,10 +726,12 @@ int main(int argc, const char **argv) { Result = Rewrite.overwriteChangedFiles(); - size_t pos = dst.rfind(".cu"); - if (pos != std::string::npos) - { - rename(dst.c_str(), dst.substr(0, pos).c_str()); + if (!Inplace) { + size_t pos = dst.rfind(".cu"); + if (pos != std::string::npos) + { + rename(dst.c_str(), dst.substr(0, pos).c_str()); + } } return Result; } From b7c7687645458f46586a24bd6cd5f2ca98287808 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Tue, 8 Mar 2016 02:03:25 +0300 Subject: [PATCH 28/82] moved all debug output into DEBUG() --- src/Cuda2Hip.cpp | 73 ++++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index cfc7c02446..f895511db8 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -278,9 +278,10 @@ namespace { if (is_angled) { if (N.cuda2hipRename.count(file_name)) { std::string repName = N.cuda2hipRename[file_name]; - llvm::errs() << "\nInclude file found: " << file_name << "\n"; - llvm::errs() << "\nSourceLocation:"; filename_range.getBegin().dump(*_sm); - llvm::errs() << "\nWill be replaced with " << repName << "\n"; + DEBUG(dbgs() << "Include file found: " << file_name << "\n"); + DEBUG(dbgs() << "SourceLocation:" + << filename_range.getBegin().printToString(*_sm) << "\n"); + DEBUG(dbgs() << "Will be replaced with " << repName << "\n"); SourceLocation sl = filename_range.getBegin(); SourceLocation sle = filename_range.getEnd(); const char* B = _sm->getCharacterData(sl); @@ -305,13 +306,12 @@ namespace { StringRef name = T.getIdentifierInfo()->getName(); if (N.cuda2hipRename.count(name)) { StringRef repName = N.cuda2hipRename[name]; - llvm::errs() << "\nIdentifier " << name - << " found in definition of macro " - << MacroNameTok.getIdentifierInfo()->getName() << "\n"; - llvm::errs() << "\nwill be replaced with: " << repName << "\n"; + DEBUG(dbgs() << "Identifier " << name + << " found in definition of macro " + << MacroNameTok.getIdentifierInfo()->getName() << "\n"); + DEBUG(dbgs() << "will be replaced with: " << repName << "\n"); SourceLocation sl = T.getLocation(); - llvm::errs() << "\nSourceLocation: ";sl.dump(*_sm); - llvm::errs() << "\n"; + DEBUG(dbgs() << "SourceLocation: " << sl.printToString(*_sm) << "\n"); Replacement Rep(*_sm, sl, name.size(), repName); Replace->insert(Rep); } @@ -348,10 +348,10 @@ namespace { StringRef name = tok.getIdentifierInfo()->getName(); if (N.cuda2hipRename.count(name)) { StringRef repName = N.cuda2hipRename[name]; - llvm::errs() << "\nIdentifier " << name + DEBUG(dbgs() << "Identifier " << name << " found as an actual argument in expansion of macro " - << macroName << "\n"; - llvm::errs() << "\nwill be replaced with: " << repName << "\n"; + << macroName << "\n"); + DEBUG(dbgs() << "will be replaced with: " << repName << "\n"); SourceLocation sl = tok.getLocation(); Replacement Rep(*_sm, sl, name.size(), repName); Replace->insert(Rep); @@ -402,7 +402,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { size_t replacementLength = OS.str().size(); SourceLocation sl = kernelDecl->getNameInfo().getEndLoc(); SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken(sl, clang::tok::l_paren, *SM, DefaultLangOptions, true); - kernelArgListStart.dump(*SM); + DEBUG(dbgs() << kernelArgListStart.printToString(*SM)); if (kernelDecl->getNumParams() > 0) { const ParmVarDecl * pvdFirst = kernelDecl->getParamDecl(0); const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams() - 1); @@ -413,29 +413,29 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); OS << ", " << initialParamList; } - llvm::outs() << "initial paramlist: " << initialParamList << "\n"; - llvm::outs() << "new paramlist: " << OS.str() << "\n"; + DEBUG(dbgs() << "initial paramlist: " << initialParamList << "\n"); + DEBUG(dbgs() << "new paramlist: " << OS.str() << "\n"); Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, OS.str()); Replace->insert(Rep0); - } + } void run(const MatchFinder::MatchResult &Result) override { SourceManager * SM = Result.SourceManager; LangOptions DefaultLangOptions; - if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) - { - const FunctionDecl * funcDcl = call->getDirectCallee(); - std::string name = funcDcl->getDeclName().getAsString(); - if (N.cuda2hipRename.count(name)) { - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = call->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); - Replace->insert(Rep); - } + if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) + { + const FunctionDecl * funcDcl = call->getDirectCallee(); + std::string name = funcDcl->getDeclName().getAsString(); + if (N.cuda2hipRename.count(name)) { + std::string repName = N.cuda2hipRename[name]; + SourceLocation sl = call->getLocStart(); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? + SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + Replace->insert(Rep); } + } if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) { @@ -460,7 +460,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << calleeName << "), "; const CallExpr * config = launchKernel->getConfig(); - llvm::outs() << "\nKernel config arguments:\n"; + DEBUG(dbgs() << "Kernel config arguments:" << "\n"); for (unsigned argno = 0; argno < config->getNumArgs(); argno++) { const Expr * arg = config->getArg(argno); @@ -471,7 +471,8 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { SourceLocation el(arg->getLocEnd()); SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); StringRef outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); - llvm::outs() << "args[ " << argno << "]" << outs << " <" << pvd->getType().getAsString() << ">\n"; + DEBUG(dbgs() << "args[ " << argno << "]" << outs << " <" + << pvd->getType().getAsString() << ">" << "\n"); if (pvd->getType().getAsString().compare("dim3") == 0) OS << " dim3(" << outs << "),"; else @@ -487,7 +488,7 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { SourceLocation el(arg->getLocEnd()); SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); - llvm::outs() << outs.c_str() << "\n"; + DEBUG(dbgs() << outs << "\n"); OS << " " << outs << ","; } XStr.pop_back(); @@ -633,6 +634,10 @@ static cl::extrahelp MoreHelp( " specify the path of source file\n\n" ) static cl::opt OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::cat(ToolTemplateCategory)); +static cl::opt +Debug("debug", cl::desc("Enable debug output"), cl::Hidden, + cl::location(llvm::DebugFlag)); + static cl::opt Inplace("inplace", cl::desc("Modify input file inplace, replacing input with hipified output, save backup in .prehip file. " "If .prehip file exists, use that as input to hip."), cl::value_desc("inplace"), cl::cat(ToolTemplateCategory)); @@ -713,15 +718,15 @@ int main(int argc, const char **argv) { &*DiagOpts, &DiagnosticPrinter, false); SourceManager Sources(Diagnostics, Tool.getFiles()); - llvm::outs() << "Replacements collected by the tool:\n"; - for (auto &r : Tool.getReplacements()) { - llvm::outs() << r.toString() << "\n"; + DEBUG(dbgs() << "Replacements collected by the tool:\n"); + for (const auto &r : Tool.getReplacements()) { + DEBUG(dbgs() << r.toString() << "\n"); } Rewriter Rewrite(Sources, DefaultLangOptions); if (!Tool.applyAllReplacements(Rewrite)) { - llvm::errs() << "Skipped some replacements.\n"; + DEBUG(dbgs() << "Skipped some replacements.\n"); } Result = Rewrite.overwriteChangedFiles(); From d30f103882e5f5df345f941ffd3b97cc0383917d Mon Sep 17 00:00:00 2001 From: dfukalov Date: Wed, 9 Mar 2016 18:37:20 +0300 Subject: [PATCH 29/82] fixed bug with -debug switch --- src/Cuda2Hip.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index f895511db8..46c60bf5be 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -634,9 +634,8 @@ static cl::extrahelp MoreHelp( " specify the path of source file\n\n" ) static cl::opt OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::cat(ToolTemplateCategory)); -static cl::opt -Debug("debug", cl::desc("Enable debug output"), cl::Hidden, - cl::location(llvm::DebugFlag)); +//static cl::opt +//Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(llvm::DebugFlag)); static cl::opt Inplace("inplace", cl::desc("Modify input file inplace, replacing input with hipified output, save backup in .prehip file. " From 7ec3377ded7d287ef455926e5bf4dab86ce4499d Mon Sep 17 00:00:00 2001 From: Daniil Fukalov Date: Tue, 22 Mar 2016 14:57:59 +0300 Subject: [PATCH 30/82] added Notes about installing dependent CUDA headers --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 0ddd4f9b91..e743c48ca0 100644 --- a/README.md +++ b/README.md @@ -45,3 +45,9 @@ sudo easy_install lit make -C path_to_hipify_src/build test ``` +# Notes +- To run, the tool needs "cuda minimal build" package: + 1. Download target installer from https://developer.nvidia.com/cuda-downloads. Choose "deb(network)" installer type to reduce downloaded packages size (we don't need the whole set) + 2. Run `sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb` + 3. Run `sudo apt-get update` + 4. Run `sudo apt-get install cuda-minimal-build-7-5` - this will install needed files, (without nvidia drivers, runtime, tools etc.) From d6b9d5fbc7f512d6e34bc2fd6cfe30c1d90cc7aa Mon Sep 17 00:00:00 2001 From: dfukalov Date: Tue, 22 Mar 2016 17:07:37 +0300 Subject: [PATCH 31/82] 1. renamed hipMallocHost -> hipHostAlloc, hipFreeHost -> hipHostFree 2. added capability to build with llvm/clang 3.8 --- src/Cuda2Hip.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 46c60bf5be..21f3755d69 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -103,9 +103,9 @@ namespace { // Memory management : cuda2hipRename["cudaMalloc"] = "hipMalloc"; - cuda2hipRename["cudaMallocHost"] = "hipMallocHost"; + cuda2hipRename["cudaMallocHost"] = "hipHostAlloc"; cuda2hipRename["cudaFree"] = "hipFree"; - cuda2hipRename["cudaFreeHost"] = "hipFreeHost"; + cuda2hipRename["cudaFreeHost"] = "hipHostFree"; // Coordinate Indexing and Dimensions: cuda2hipRename["threadIdx.x"] = "hipThreadIdx_x"; @@ -334,7 +334,11 @@ namespace { // to workaround the 'const' MacroArgs passed into this hook. const Token * start = Args->getUnexpArgument(i); size_t len = Args->getArgLength(start) + 1; +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 9) _pp->EnterTokenStream(ArrayRef(start,len), false); +#else + _pp->EnterTokenStream(start, len, false, false); +#endif do { toks.push_back(Token()); Token & tk = toks.back(); From 8c9274599974c39cd307aa19f557bb2ae6a0803e Mon Sep 17 00:00:00 2001 From: Daniil Fukalov Date: Tue, 22 Mar 2016 17:59:11 +0300 Subject: [PATCH 32/82] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e743c48ca0..743a1a63b2 100644 --- a/README.md +++ b/README.md @@ -50,4 +50,4 @@ make -C path_to_hipify_src/build test 1. Download target installer from https://developer.nvidia.com/cuda-downloads. Choose "deb(network)" installer type to reduce downloaded packages size (we don't need the whole set) 2. Run `sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb` 3. Run `sudo apt-get update` - 4. Run `sudo apt-get install cuda-minimal-build-7-5` - this will install needed files, (without nvidia drivers, runtime, tools etc.) + 4. Run `sudo apt-get install cuda-minimal-build-7-5 cuda-curand-dev-7-5` - this will install needed files, (without nvidia drivers, runtime, tools etc.) From 0ca2467c6bf8b3746b6072971edc6839ac29f7e9 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Tue, 22 Mar 2016 19:48:29 +0300 Subject: [PATCH 33/82] migrating from std::string to StringRef --- src/Cuda2Hip.cpp | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index 21f3755d69..d80e685c23 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -277,7 +277,7 @@ namespace { if (_sm->isWrittenInMainFile(hash_loc)) { if (is_angled) { if (N.cuda2hipRename.count(file_name)) { - std::string repName = N.cuda2hipRename[file_name]; + StringRef repName = N.cuda2hipRename[file_name]; DEBUG(dbgs() << "Include file found: " << file_name << "\n"); DEBUG(dbgs() << "SourceLocation:" << filename_range.getBegin().printToString(*_sm) << "\n"); @@ -286,8 +286,8 @@ namespace { SourceLocation sle = filename_range.getEnd(); const char* B = _sm->getCharacterData(sl); const char* E = _sm->getCharacterData(sle); - repName = "<" + repName + ">"; - Replacement Rep(*_sm, sl, E - B, repName); + SmallString<128> tmpData; + Replacement Rep(*_sm, sl, E - B, Twine("<" + repName + ">").toStringRef(tmpData)); Replace->insert(Rep); } } @@ -431,12 +431,12 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) { const FunctionDecl * funcDcl = call->getDirectCallee(); - std::string name = funcDcl->getDeclName().getAsString(); + StringRef name = funcDcl->getDeclName().getAsString(); if (N.cuda2hipRename.count(name)) { - std::string repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name]; SourceLocation sl = call->getLocStart(); Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.length(), repName); + SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); Replace->insert(Rep); } } @@ -513,14 +513,15 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { { if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { if (const DeclRefExpr * declRef = dyn_cast(refBase->getSourceExpr())) { - std::string name = declRef->getDecl()->getNameAsString(); - std::string memberName = threadIdx->getMemberDecl()->getNameAsString(); - size_t pos = memberName.find_first_not_of("__fetch_builtin_"); - memberName = memberName.substr(pos, memberName.length() - pos); - name += "." + memberName; - std::string repName = N.cuda2hipRename[name]; - SourceLocation sl = threadIdx->getLocStart(); - Replacement Rep(*SM, sl, name.length(), repName); + StringRef name = declRef->getDecl()->getName(); + StringRef memberName = threadIdx->getMemberDecl()->getName(); + size_t pos = memberName.find_first_not_of("__fetch_builtin_"); + memberName = memberName.slice(pos, memberName.size()); + SmallString<128> tmpData; + name = Twine(name+"."+memberName).toStringRef(tmpData); + StringRef repName = N.cuda2hipRename[name]; + SourceLocation sl = threadIdx->getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } } @@ -528,30 +529,29 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { if (const DeclRefExpr * cudaEnumConstantRef = Result.Nodes.getNodeAs("cudaEnumConstantRef")) { - std::string name = cudaEnumConstantRef->getDecl()->getNameAsString(); - std::string repName = N.cuda2hipRename[name]; + StringRef name = cudaEnumConstantRef->getDecl()->getNameAsString(); + StringRef repName = N.cuda2hipRename[name]; SourceLocation sl = cudaEnumConstantRef->getLocStart(); - Replacement Rep(*SM, sl, name.length(), repName); + Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } if (const VarDecl * cudaEnumConstantDecl = Result.Nodes.getNodeAs("cudaEnumConstantDecl")) { - std::string name = cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); - std::string repName = N.cuda2hipRename[name]; + StringRef name = cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); + StringRef repName = N.cuda2hipRename[name]; SourceLocation sl = cudaEnumConstantDecl->getLocStart(); - Replacement Rep(*SM, sl, name.length(), repName); + Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } if (const VarDecl * cudaStructVar = Result.Nodes.getNodeAs("cudaStructVar")) { - std::string name = - cudaStructVar->getType()->getAsStructureType()->getDecl()->getNameAsString(); - std::string repName = N.cuda2hipRename[name]; + StringRef name = cudaStructVar->getType()->getAsStructureType()->getDecl()->getNameAsString(); + StringRef repName = N.cuda2hipRename[name]; TypeLoc TL = cudaStructVar->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.length(), repName); + Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } From 1921bf1400894a6823061b111492738ddb9ffa0f Mon Sep 17 00:00:00 2001 From: dfukalov Date: Thu, 24 Mar 2016 14:54:14 +0300 Subject: [PATCH 34/82] source reformatted to LLVM style, minor cleanups --- src/Cuda2Hip.cpp | 905 +++++++++++++++++++++++++---------------------- 1 file changed, 479 insertions(+), 426 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index d80e685c23..db8527835f 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -24,28 +24,28 @@ THE SOFTWARE. * * This file is compiled and linked into clang based hipify tool. */ -#include "clang/ASTMatchers/ASTMatchers.h" #include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" #include "clang/Basic/SourceManager.h" +#include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendActions.h" +#include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Lex/Lexer.h" +#include "clang/Lex/MacroArgs.h" +#include "clang/Lex/MacroInfo.h" +#include "clang/Lex/PPCallbacks.h" +#include "clang/Lex/Preprocessor.h" +#include "clang/Rewrite/Core/Rewriter.h" #include "clang/Tooling/CommonOptionsParser.h" #include "clang/Tooling/Refactoring.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Signals.h" -#include "llvm/Support/Debug.h" -#include "clang/Frontend/TextDiagnosticPrinter.h" -#include "clang/Rewrite/Core/Rewriter.h" -#include "clang/Lex/MacroInfo.h" -#include "clang/Frontend/CompilerInstance.h" -#include "clang/Lex/Preprocessor.h" -#include "clang/Lex/PPCallbacks.h" -#include "clang/Lex/MacroArgs.h" -#include #include +#include using namespace clang; using namespace clang::ast_matchers; @@ -55,428 +55,436 @@ using namespace llvm; #define DEBUG_TYPE "cuda2hip" namespace { - struct hipName { +struct hipName { hipName() { - // defines - cuda2hipRename["__CUDACC__"] = "__HIPCC__"; + // defines + cuda2hipRename["__CUDACC__"] = "__HIPCC__"; - // includes - cuda2hipRename["cuda_runtime.h"] = "hip_runtime.h"; - cuda2hipRename["cuda_runtime_api.h"] = "hip_runtime_api.h"; + // includes + cuda2hipRename["cuda_runtime.h"] = "hip_runtime.h"; + cuda2hipRename["cuda_runtime_api.h"] = "hip_runtime_api.h"; - // Error codes and return types: - cuda2hipRename["cudaError_t"] = "hipError_t"; - cuda2hipRename["cudaError"] = "hipError"; - cuda2hipRename["cudaSuccess"] = "hipSuccess"; + // Error codes and return types: + cuda2hipRename["cudaError_t"] = "hipError_t"; + cuda2hipRename["cudaError"] = "hipError"; + cuda2hipRename["cudaSuccess"] = "hipSuccess"; - cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; - cuda2hipRename["cudaErrorMemoryAllocation"] = "hipErrorMemoryAllocation"; - cuda2hipRename["cudaErrorMemoryFree"] = "hipErrorMemoryFree"; - cuda2hipRename["cudaErrorUnknownSymbol"] = "hipErrorUnknownSymbol"; - cuda2hipRename["cudaErrorOutOfResources"] = "hipErrorOutOfResources"; - cuda2hipRename["cudaErrorInvalidValue"] = "hipErrorInvalidValue"; - cuda2hipRename["cudaErrorInvalidResourceHandle"] = "hipErrorInvalidResourceHandle"; - cuda2hipRename["cudaErrorInvalidDevice"] = "hipErrorInvalidDevice"; - cuda2hipRename["cudaErrorNoDevice"] = "hipErrorNoDevice"; - cuda2hipRename["cudaErrorNotReady"] = "hipErrorNotReady"; - cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; + cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; + cuda2hipRename["cudaErrorMemoryAllocation"] = "hipErrorMemoryAllocation"; + cuda2hipRename["cudaErrorMemoryFree"] = "hipErrorMemoryFree"; + cuda2hipRename["cudaErrorUnknownSymbol"] = "hipErrorUnknownSymbol"; + cuda2hipRename["cudaErrorOutOfResources"] = "hipErrorOutOfResources"; + cuda2hipRename["cudaErrorInvalidValue"] = "hipErrorInvalidValue"; + cuda2hipRename["cudaErrorInvalidResourceHandle"] = + "hipErrorInvalidResourceHandle"; + cuda2hipRename["cudaErrorInvalidDevice"] = "hipErrorInvalidDevice"; + cuda2hipRename["cudaErrorNoDevice"] = "hipErrorNoDevice"; + cuda2hipRename["cudaErrorNotReady"] = "hipErrorNotReady"; + cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; - // error APIs: - cuda2hipRename["cudaGetLastError"] = "hipGetLastError"; - cuda2hipRename["cudaPeekAtLastError"] = "hipPeekAtLastError"; - cuda2hipRename["cudaGetErrorName"] = "hipGetErrorName"; - cuda2hipRename["cudaGetErrorString"] = "hipGetErrorString"; + // error APIs: + cuda2hipRename["cudaGetLastError"] = "hipGetLastError"; + cuda2hipRename["cudaPeekAtLastError"] = "hipPeekAtLastError"; + cuda2hipRename["cudaGetErrorName"] = "hipGetErrorName"; + cuda2hipRename["cudaGetErrorString"] = "hipGetErrorString"; - // Memcpy - cuda2hipRename["cudaMemcpy"] = "hipMemcpy"; - cuda2hipRename["cudaMemcpyHostToHost"] = "hipMemcpyHostToHost"; - cuda2hipRename["cudaMemcpyHostToDevice"] = "hipMemcpyHostToDevice"; - cuda2hipRename["cudaMemcpyDeviceToHost"] = "hipMemcpyDeviceToHost"; - cuda2hipRename["cudaMemcpyDeviceToDevice"] = "hipMemcpyDeviceToDevice"; - cuda2hipRename["cudaMemcpyDefault"] = "hipMemcpyDefault"; - cuda2hipRename["cudaMemcpyToSymbol"] = "hipMemcpyToSymbol"; - cuda2hipRename["cudaMemset"] = "hipMemset"; - cuda2hipRename["cudaMemsetAsync"] = "hipMemsetAsync"; - cuda2hipRename["cudaMemcpyAsync"] = "hipMemcpyAsync"; - cuda2hipRename["cudaMemGetInfo"] = "hipMemGetInfo"; - cuda2hipRename["cudaMemcpyKind"] = "hipMemcpyKind"; + // Memcpy + cuda2hipRename["cudaMemcpy"] = "hipMemcpy"; + cuda2hipRename["cudaMemcpyHostToHost"] = "hipMemcpyHostToHost"; + cuda2hipRename["cudaMemcpyHostToDevice"] = "hipMemcpyHostToDevice"; + cuda2hipRename["cudaMemcpyDeviceToHost"] = "hipMemcpyDeviceToHost"; + cuda2hipRename["cudaMemcpyDeviceToDevice"] = "hipMemcpyDeviceToDevice"; + cuda2hipRename["cudaMemcpyDefault"] = "hipMemcpyDefault"; + cuda2hipRename["cudaMemcpyToSymbol"] = "hipMemcpyToSymbol"; + cuda2hipRename["cudaMemset"] = "hipMemset"; + cuda2hipRename["cudaMemsetAsync"] = "hipMemsetAsync"; + cuda2hipRename["cudaMemcpyAsync"] = "hipMemcpyAsync"; + cuda2hipRename["cudaMemGetInfo"] = "hipMemGetInfo"; + cuda2hipRename["cudaMemcpyKind"] = "hipMemcpyKind"; - // Memory management : - cuda2hipRename["cudaMalloc"] = "hipMalloc"; - cuda2hipRename["cudaMallocHost"] = "hipHostAlloc"; - cuda2hipRename["cudaFree"] = "hipFree"; - cuda2hipRename["cudaFreeHost"] = "hipHostFree"; + // Memory management : + cuda2hipRename["cudaMalloc"] = "hipMalloc"; + cuda2hipRename["cudaMallocHost"] = "hipHostAlloc"; + cuda2hipRename["cudaFree"] = "hipFree"; + cuda2hipRename["cudaFreeHost"] = "hipHostFree"; - // Coordinate Indexing and Dimensions: - cuda2hipRename["threadIdx.x"] = "hipThreadIdx_x"; - cuda2hipRename["threadIdx.y"] = "hipThreadIdx_y"; - cuda2hipRename["threadIdx.z"] = "hipThreadIdx_z"; + // Coordinate Indexing and Dimensions: + cuda2hipRename["threadIdx.x"] = "hipThreadIdx_x"; + cuda2hipRename["threadIdx.y"] = "hipThreadIdx_y"; + cuda2hipRename["threadIdx.z"] = "hipThreadIdx_z"; - cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; - cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; - cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; + cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; + cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; + cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; - cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; - cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; - cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; + cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; + cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; + cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; - cuda2hipRename["gridDim.x"] = "hipGridDim_x"; - cuda2hipRename["gridDim.y"] = "hipGridDim_y"; - cuda2hipRename["gridDim.z"] = "hipGridDim_z"; + cuda2hipRename["gridDim.x"] = "hipGridDim_x"; + cuda2hipRename["gridDim.y"] = "hipGridDim_y"; + cuda2hipRename["gridDim.z"] = "hipGridDim_z"; - cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; - cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; - cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; + cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; + cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; + cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; - cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; - cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; - cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; + cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; + cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; + cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; - cuda2hipRename["gridDim.x"] = "hipGridDim_x"; - cuda2hipRename["gridDim.y"] = "hipGridDim_y"; - cuda2hipRename["gridDim.z"] = "hipGridDim_z"; + cuda2hipRename["gridDim.x"] = "hipGridDim_x"; + cuda2hipRename["gridDim.y"] = "hipGridDim_y"; + cuda2hipRename["gridDim.z"] = "hipGridDim_z"; + cuda2hipRename["warpSize"] = "hipWarpSize"; - cuda2hipRename["warpSize"] = "hipWarpSize"; + // Events + cuda2hipRename["cudaEvent_t"] = "hipEvent_t"; + cuda2hipRename["cudaEventCreate"] = "hipEventCreate"; + cuda2hipRename["cudaEventCreateWithFlags"] = "hipEventCreateWithFlags"; + cuda2hipRename["cudaEventDestroy"] = "hipEventDestroy"; + cuda2hipRename["cudaEventRecord"] = "hipEventRecord"; + cuda2hipRename["cudaEventElapsedTime"] = "hipEventElapsedTime"; + cuda2hipRename["cudaEventSynchronize"] = "hipEventSynchronize"; - // Events - cuda2hipRename["cudaEvent_t"] = "hipEvent_t"; - cuda2hipRename["cudaEventCreate"] = "hipEventCreate"; - cuda2hipRename["cudaEventCreateWithFlags"] = "hipEventCreateWithFlags"; - cuda2hipRename["cudaEventDestroy"] = "hipEventDestroy"; - cuda2hipRename["cudaEventRecord"] = "hipEventRecord"; - cuda2hipRename["cudaEventElapsedTime"] = "hipEventElapsedTime"; - cuda2hipRename["cudaEventSynchronize"] = "hipEventSynchronize"; + // Streams + cuda2hipRename["cudaStream_t"] = "hipStream_t"; + cuda2hipRename["cudaStreamCreate"] = "hipStreamCreate"; + cuda2hipRename["cudaStreamCreateWithFlags"] = "hipStreamCreateWithFlags"; + cuda2hipRename["cudaStreamDestroy"] = "hipStreamDestroy"; + cuda2hipRename["cudaStreamWaitEvent"] = "hipStreamWaitEven"; + cuda2hipRename["cudaStreamSynchronize"] = "hipStreamSynchronize"; + cuda2hipRename["cudaStreamDefault"] = "hipStreamDefault"; + cuda2hipRename["cudaStreamNonBlocking"] = "hipStreamNonBlocking"; - // Streams - cuda2hipRename["cudaStream_t"] = "hipStream_t"; - cuda2hipRename["cudaStreamCreate"] = "hipStreamCreate"; - cuda2hipRename["cudaStreamCreateWithFlags"] = "hipStreamCreateWithFlags"; - cuda2hipRename["cudaStreamDestroy"] = "hipStreamDestroy"; - cuda2hipRename["cudaStreamWaitEvent"] = "hipStreamWaitEven"; - cuda2hipRename["cudaStreamSynchronize"] = "hipStreamSynchronize"; - cuda2hipRename["cudaStreamDefault"] = "hipStreamDefault"; - cuda2hipRename["cudaStreamNonBlocking"] = "hipStreamNonBlocking"; + // Other synchronization + cuda2hipRename["cudaDeviceSynchronize"] = "hipDeviceSynchronize"; + cuda2hipRename["cudaThreadSynchronize"] = + "hipDeviceSynchronize"; // translate deprecated cudaThreadSynchronize + cuda2hipRename["cudaDeviceReset"] = "hipDeviceReset"; + cuda2hipRename["cudaThreadExit"] = + "hipDeviceReset"; // translate deprecated cudaThreadExit + cuda2hipRename["cudaSetDevice"] = "hipSetDevice"; + cuda2hipRename["cudaGetDevice"] = "hipGetDevice"; - // Other synchronization - cuda2hipRename["cudaDeviceSynchronize"] = "hipDeviceSynchronize"; - cuda2hipRename["cudaThreadSynchronize"] = "hipDeviceSynchronize"; // translate deprecated cudaThreadSynchronize - cuda2hipRename["cudaDeviceReset"] = "hipDeviceReset"; - cuda2hipRename["cudaThreadExit"] = "hipDeviceReset"; // translate deprecated cudaThreadExit - cuda2hipRename["cudaSetDevice"] = "hipSetDevice"; - cuda2hipRename["cudaGetDevice"] = "hipGetDevice"; + // Device + cuda2hipRename["cudaDeviceProp"] = "hipDeviceProp_t"; + cuda2hipRename["cudaGetDeviceProperties"] = "hipDeviceGetProperties"; - // Device - cuda2hipRename["cudaDeviceProp"] = "hipDeviceProp_t"; - cuda2hipRename["cudaGetDeviceProperties"] = "hipDeviceGetProperties"; + // Cache config + cuda2hipRename["cudaDeviceSetCacheConfig"] = "hipDeviceSetCacheConfig"; + cuda2hipRename["cudaThreadSetCacheConfig"] = + "hipDeviceSetCacheConfig"; // translate deprecated + cuda2hipRename["cudaDeviceGetCacheConfig"] = "hipDeviceGetCacheConfig"; + cuda2hipRename["cudaThreadGetCacheConfig"] = + "hipDeviceGetCacheConfig"; // translate deprecated + cuda2hipRename["cudaFuncCache"] = "hipFuncCache"; + cuda2hipRename["cudaFuncCachePreferNone"] = "hipFuncCachePreferNone"; + cuda2hipRename["cudaFuncCachePreferShared"] = "hipFuncCachePreferShared"; + cuda2hipRename["cudaFuncCachePreferL1"] = "hipFuncCachePreferL1"; + cuda2hipRename["cudaFuncCachePreferEqual"] = "hipFuncCachePreferEqual"; + // function + cuda2hipRename["cudaFuncSetCacheConfig"] = "hipFuncSetCacheConfig"; - // Cache config - cuda2hipRename["cudaDeviceSetCacheConfig"] = "hipDeviceSetCacheConfig"; - cuda2hipRename["cudaThreadSetCacheConfig"] = "hipDeviceSetCacheConfig"; // translate deprecated - cuda2hipRename["cudaDeviceGetCacheConfig"] = "hipDeviceGetCacheConfig"; - cuda2hipRename["cudaThreadGetCacheConfig"] = "hipDeviceGetCacheConfig"; // translate deprecated - cuda2hipRename["cudaFuncCache"] = "hipFuncCache"; - cuda2hipRename["cudaFuncCachePreferNone"] = "hipFuncCachePreferNone"; - cuda2hipRename["cudaFuncCachePreferShared"] = "hipFuncCachePreferShared"; - cuda2hipRename["cudaFuncCachePreferL1"] = "hipFuncCachePreferL1"; - cuda2hipRename["cudaFuncCachePreferEqual"] = "hipFuncCachePreferEqual"; - // function - cuda2hipRename["cudaFuncSetCacheConfig"] = "hipFuncSetCacheConfig"; + cuda2hipRename["cudaDriverGetVersion"] = "hipDriverGetVersion"; + cuda2hipRename["cudaRuntimeGetVersion"] = "hipRuntimeGetVersion"; - cuda2hipRename["cudaDriverGetVersion"] = "hipDriverGetVersion"; - cuda2hipRename["cudaRuntimeGetVersion"] = "hipRuntimeGetVersion"; + // Peer2Peer + cuda2hipRename["cudaDeviceCanAccessPeer"] = "hipDeviceCanAccessPeer"; + cuda2hipRename["cudaDeviceDisablePeerAccess"] = + "hipDeviceDisablePeerAccess"; + cuda2hipRename["cudaDeviceEnablePeerAccess"] = "hipDeviceEnablePeerAccess"; + cuda2hipRename["cudaMemcpyPeerAsync"] = "hipMemcpyPeerAsync"; + cuda2hipRename["cudaMemcpyPeer"] = "hipMemcpyPeer"; - // Peer2Peer - cuda2hipRename["cudaDeviceCanAccessPeer"] = "hipDeviceCanAccessPeer"; - cuda2hipRename["cudaDeviceDisablePeerAccess"] = "hipDeviceDisablePeerAccess"; - cuda2hipRename["cudaDeviceEnablePeerAccess"] = "hipDeviceEnablePeerAccess"; - cuda2hipRename["cudaMemcpyPeerAsync"] = "hipMemcpyPeerAsync"; - cuda2hipRename["cudaMemcpyPeer"] = "hipMemcpyPeer"; + // Shared mem: + cuda2hipRename["cudaDeviceSetSharedMemConfig"] = + "hipDeviceSetSharedMemConfig"; + cuda2hipRename["cudaThreadSetSharedMemConfig"] = + "hipDeviceSetSharedMemConfig"; // translate deprecated + cuda2hipRename["cudaDeviceGetSharedMemConfig"] = + "hipDeviceGetSharedMemConfig"; + cuda2hipRename["cudaThreadGetSharedMemConfig"] = + "hipDeviceGetSharedMemConfig"; // translate deprecated + cuda2hipRename["cudaSharedMemConfig"] = "hipSharedMemConfig"; + cuda2hipRename["cudaSharedMemBankSizeDefault"] = + "hipSharedMemBankSizeDefault"; + cuda2hipRename["cudaSharedMemBankSizeFourByte"] = + "hipSharedMemBankSizeFourByte"; + cuda2hipRename["cudaSharedMemBankSizeEightByte"] = + "hipSharedMemBankSizeEightByte"; - // Shared mem: - cuda2hipRename["cudaDeviceSetSharedMemConfig"] = "hipDeviceSetSharedMemConfig"; - cuda2hipRename["cudaThreadSetSharedMemConfig"] = "hipDeviceSetSharedMemConfig"; // translate deprecated - cuda2hipRename["cudaDeviceGetSharedMemConfig"] = "hipDeviceGetSharedMemConfig"; - cuda2hipRename["cudaThreadGetSharedMemConfig"] = "hipDeviceGetSharedMemConfig"; // translate deprecated - cuda2hipRename["cudaSharedMemConfig"] = "hipSharedMemConfig"; - cuda2hipRename["cudaSharedMemBankSizeDefault"] = "hipSharedMemBankSizeDefault"; - cuda2hipRename["cudaSharedMemBankSizeFourByte"] = "hipSharedMemBankSizeFourByte"; - cuda2hipRename["cudaSharedMemBankSizeEightByte"] = "hipSharedMemBankSizeEightByte"; + cuda2hipRename["cudaGetDeviceCount"] = "hipGetDeviceCount"; - cuda2hipRename["cudaGetDeviceCount"] = "hipGetDeviceCount"; + // Profiler + // cuda2hipRename["cudaProfilerInitialize"] = "hipProfilerInitialize"; // + // see if these are called anywhere. + cuda2hipRename["cudaProfilerStart"] = "hipProfilerStart"; + cuda2hipRename["cudaProfilerStop"] = "hipProfilerStop"; - // Profiler - //cuda2hipRename["cudaProfilerInitialize"] = "hipProfilerInitialize"; // see if these are called anywhere. - cuda2hipRename["cudaProfilerStart"] = "hipProfilerStart"; - cuda2hipRename["cudaProfilerStop"] = "hipProfilerStop"; + cuda2hipRename["cudaChannelFormatDesc"] = "hipChannelFormatDesc"; + cuda2hipRename["cudaFilterModePoint"] = "hipFilterModePoint"; + cuda2hipRename["cudaReadModeElementType"] = "hipReadModeElementType"; - cuda2hipRename["cudaChannelFormatDesc"] = "hipChannelFormatDesc"; - cuda2hipRename["cudaFilterModePoint"] = "hipFilterModePoint"; - cuda2hipRename["cudaReadModeElementType"] = "hipReadModeElementType"; + cuda2hipRename["cudaCreateChannelDesc"] = "hipCreateChannelDesc"; + cuda2hipRename["cudaBindTexture"] = "hipBindTexture"; + cuda2hipRename["cudaUnbindTexture"] = "hipUnbindTexture"; + } + DenseMap cuda2hipRename; +}; - cuda2hipRename["cudaCreateChannelDesc"] = "hipCreateChannelDesc"; - cuda2hipRename["cudaBindTexture"] = "hipBindTexture"; - cuda2hipRename["cudaUnbindTexture"] = "hipUnbindTexture"; +StringRef unquoteStr(StringRef s) { + if (s.size() > 1 && s.front() == '"' && s.back() == '"') + return s.substr(1, s.size() - 2); + return s; +} + +void processString(StringRef s, struct hipName &map, Replacements *Replace, + SourceManager &SM, SourceLocation start) { + size_t begin = 0; + while ((begin = s.find("cuda", begin)) != StringRef::npos) { + const size_t end = s.find_first_of(" ", begin + 4); + StringRef name = s.slice(begin, end); + StringRef repName = map.cuda2hipRename[name]; + if (!repName.empty()) { + SourceLocation sl = start.getLocWithOffset(begin + 1); + Replacement Rep(SM, sl, name.size(), repName); + Replace->insert(Rep); } - DenseMap cuda2hipRename; - }; + if (end == StringRef::npos) + break; + begin = end + 1; + } +} - StringRef unquoteStr(StringRef s) { - if (s.size() > 1 && s.front() == '"' && s.back() == '"') - return s.substr(1, s.size()-2); - return s; +struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { + HipifyPPCallbacks(Replacements *R) + : SeenEnd(false), _sm(nullptr), _pp(nullptr), Replace(R) {} + + virtual bool handleBeginSource(CompilerInstance &CI, + StringRef Filename) override { + Preprocessor &PP = CI.getPreprocessor(); + SourceManager &SM = CI.getSourceManager(); + setSourceManager(&SM); + PP.addPPCallbacks(std::unique_ptr(this)); + PP.Retain(); + setPreprocessor(&PP); + return true; } - void processString(StringRef s, struct hipName & map, - Replacements * Replace, SourceManager & SM, SourceLocation start) - { - size_t begin = 0; - while ((begin = s.find("cuda", begin)) != StringRef::npos) { - const size_t end = s.find_first_of(" ", begin + 4); - StringRef name = s.slice(begin, end); - StringRef repName = map.cuda2hipRename[name]; - if (!repName.empty()) { - SourceLocation sl = start.getLocWithOffset(begin + 1); - Replacement Rep(SM, sl, name.size(), repName); - Replace->insert(Rep); + virtual void InclusionDirective(SourceLocation hash_loc, + const Token &include_token, + StringRef file_name, bool is_angled, + CharSourceRange filename_range, + const FileEntry *file, StringRef search_path, + StringRef relative_path, + const clang::Module *imported) override { + if (_sm->isWrittenInMainFile(hash_loc)) { + if (is_angled) { + if (N.cuda2hipRename.count(file_name)) { + StringRef repName = N.cuda2hipRename[file_name]; + DEBUG(dbgs() << "Include file found: " << file_name << "\n" + << "SourceLocation:" + << filename_range.getBegin().printToString(*_sm) << "\n" + << "Will be replaced with " << repName << "\n"); + SourceLocation sl = filename_range.getBegin(); + SourceLocation sle = filename_range.getEnd(); + const char *B = _sm->getCharacterData(sl); + const char *E = _sm->getCharacterData(sle); + SmallString<128> tmpData; + Replacement Rep(*_sm, sl, E - B, + Twine("<" + repName + ">").toStringRef(tmpData)); + Replace->insert(Rep); + } } - if (end == StringRef::npos) break; - begin = end + 1; } } - - struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { - HipifyPPCallbacks(Replacements * R) - : SeenEnd(false), _sm(nullptr), _pp(nullptr), Replace(R) - { - } - - virtual bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override - { - Preprocessor &PP = CI.getPreprocessor(); - SourceManager & SM = CI.getSourceManager(); - setSourceManager(&SM); - PP.addPPCallbacks(std::unique_ptr(this)); - PP.Retain(); - setPreprocessor(&PP); - return true; - } - - virtual void InclusionDirective( - SourceLocation hash_loc, - const Token &include_token, - StringRef file_name, - bool is_angled, - CharSourceRange filename_range, - const FileEntry *file, - StringRef search_path, - StringRef relative_path, - const clang::Module *imported) override - { - if (_sm->isWrittenInMainFile(hash_loc)) { - if (is_angled) { - if (N.cuda2hipRename.count(file_name)) { - StringRef repName = N.cuda2hipRename[file_name]; - DEBUG(dbgs() << "Include file found: " << file_name << "\n"); - DEBUG(dbgs() << "SourceLocation:" - << filename_range.getBegin().printToString(*_sm) << "\n"); - DEBUG(dbgs() << "Will be replaced with " << repName << "\n"); - SourceLocation sl = filename_range.getBegin(); - SourceLocation sle = filename_range.getEnd(); - const char* B = _sm->getCharacterData(sl); - const char* E = _sm->getCharacterData(sle); - SmallString<128> tmpData; - Replacement Rep(*_sm, sl, E - B, Twine("<" + repName + ">").toStringRef(tmpData)); + virtual void MacroDefined(const Token &MacroNameTok, + const MacroDirective *MD) override { + if (_sm->isWrittenInMainFile(MD->getLocation()) && + MD->getKind() == MacroDirective::MD_Define) { + for (auto T : MD->getMacroInfo()->tokens()) { + if (T.isAnyIdentifier()) { + StringRef name = T.getIdentifierInfo()->getName(); + if (N.cuda2hipRename.count(name)) { + StringRef repName = N.cuda2hipRename[name]; + SourceLocation sl = T.getLocation(); + DEBUG(dbgs() << "Identifier " << name + << " found in definition of macro " + << MacroNameTok.getIdentifierInfo()->getName() << "\n" + << "will be replaced with: " << repName << "\n" + << "SourceLocation: " << sl.printToString(*_sm) + << "\n"); + Replacement Rep(*_sm, sl, name.size(), repName); Replace->insert(Rep); } } } } + } - virtual void MacroDefined(const Token &MacroNameTok, - const MacroDirective *MD) override - { - if (_sm->isWrittenInMainFile(MD->getLocation()) && - MD->getKind() == MacroDirective::MD_Define) - { - for (auto T : MD->getMacroInfo()->tokens()) - { - if (T.isAnyIdentifier()) { - StringRef name = T.getIdentifierInfo()->getName(); + virtual void MacroExpands(const Token &MacroNameTok, + const MacroDefinition &MD, SourceRange Range, + const MacroArgs *Args) override { + if (_sm->isWrittenInMainFile(MacroNameTok.getLocation())) { + for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); + i++) { + StringRef macroName = MacroNameTok.getIdentifierInfo()->getName(); + std::vector toks; + // Code below is a kind of stolen from 'MacroArgs::getPreExpArgument' + // to workaround the 'const' MacroArgs passed into this hook. + const Token *start = Args->getUnexpArgument(i); + size_t len = Args->getArgLength(start) + 1; +#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 9) + _pp->EnterTokenStream(ArrayRef(start, len), false); +#else + _pp->EnterTokenStream(start, len, false, false); +#endif + do { + toks.push_back(Token()); + Token &tk = toks.back(); + _pp->Lex(tk); + } while (toks.back().isNot(tok::eof)); + _pp->RemoveTopOfLexerStack(); + // end of stolen code + for (auto tok : toks) { + if (tok.isAnyIdentifier()) { + StringRef name = tok.getIdentifierInfo()->getName(); if (N.cuda2hipRename.count(name)) { StringRef repName = N.cuda2hipRename[name]; DEBUG(dbgs() << "Identifier " << name - << " found in definition of macro " - << MacroNameTok.getIdentifierInfo()->getName() << "\n"); - DEBUG(dbgs() << "will be replaced with: " << repName << "\n"); - SourceLocation sl = T.getLocation(); - DEBUG(dbgs() << "SourceLocation: " << sl.printToString(*_sm) << "\n"); + << " found as an actual argument in expansion of macro " + << macroName << "\n" + << "will be replaced with: " << repName << "\n"); + SourceLocation sl = tok.getLocation(); Replacement Rep(*_sm, sl, name.size(), repName); Replace->insert(Rep); } } - } - } - } - - virtual void MacroExpands(const Token &MacroNameTok, - const MacroDefinition &MD, SourceRange Range, - const MacroArgs *Args) override - { - if (_sm->isWrittenInMainFile(MacroNameTok.getLocation())) - { - for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); i++) - { - StringRef macroName = MacroNameTok.getIdentifierInfo()->getName(); - std::vector toks; - // Code below is a kind of stolen from 'MacroArgs::getPreExpArgument' - // to workaround the 'const' MacroArgs passed into this hook. - const Token * start = Args->getUnexpArgument(i); - size_t len = Args->getArgLength(start) + 1; -#if (LLVM_VERSION_MAJOR >= 3) && (LLVM_VERSION_MINOR >= 9) - _pp->EnterTokenStream(ArrayRef(start,len), false); -#else - _pp->EnterTokenStream(start, len, false, false); -#endif - do { - toks.push_back(Token()); - Token & tk = toks.back(); - _pp->Lex(tk); - } while (toks.back().isNot(tok::eof)); - _pp->RemoveTopOfLexerStack(); - // end of stolen code - for (auto tok : toks) { - if (tok.isAnyIdentifier()) - { - StringRef name = tok.getIdentifierInfo()->getName(); - if (N.cuda2hipRename.count(name)) { - StringRef repName = N.cuda2hipRename[name]; - DEBUG(dbgs() << "Identifier " << name - << " found as an actual argument in expansion of macro " - << macroName << "\n"); - DEBUG(dbgs() << "will be replaced with: " << repName << "\n"); - SourceLocation sl = tok.getLocation(); - Replacement Rep(*_sm, sl, name.size(), repName); - Replace->insert(Rep); - } - } - if (tok.is(tok::string_literal)) - { - StringRef s(tok.getLiteralData(), tok.getLength()); - processString(unquoteStr(s), N, Replace, *_sm, tok.getLocation()); - } + if (tok.is(tok::string_literal)) { + StringRef s(tok.getLiteralData(), tok.getLength()); + processString(unquoteStr(s), N, Replace, *_sm, tok.getLocation()); } } } } + } - void EndOfMainFile() override - { + void EndOfMainFile() override {} - } + bool SeenEnd; + void setSourceManager(SourceManager *sm) { _sm = sm; } + void setPreprocessor(Preprocessor *pp) { _pp = pp; } - bool SeenEnd; - void setSourceManager(SourceManager * sm) { _sm = sm; } - void setPreprocessor (Preprocessor * pp) { _pp = pp; } +private: + SourceManager *_sm; + Preprocessor *_pp; - private: - - SourceManager * _sm; - Preprocessor * _pp; - - Replacements * Replace; - struct hipName N; - }; + Replacements *Replace; + struct hipName N; +}; class Cuda2HipCallback : public MatchFinder::MatchCallback { - public: - Cuda2HipCallback(Replacements *Replace, ast_matchers::MatchFinder *parent) - : Replace(Replace), owner(parent) {} +public: + Cuda2HipCallback(Replacements *Replace, ast_matchers::MatchFinder *parent) + : Replace(Replace), owner(parent) {} - void convertKernelDecl(const FunctionDecl * kernelDecl, const MatchFinder::MatchResult &Result) - { - SourceManager * SM = Result.SourceManager; - LangOptions DefaultLangOptions; + void convertKernelDecl(const FunctionDecl *kernelDecl, + const MatchFinder::MatchResult &Result) { + SourceManager *SM = Result.SourceManager; + LangOptions DefaultLangOptions; - SmallString<40> XStr; - raw_svector_ostream OS(XStr); - StringRef initialParamList; - OS << "hipLaunchParm lp"; - size_t replacementLength = OS.str().size(); - SourceLocation sl = kernelDecl->getNameInfo().getEndLoc(); - SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken(sl, clang::tok::l_paren, *SM, DefaultLangOptions, true); - DEBUG(dbgs() << kernelArgListStart.printToString(*SM)); - if (kernelDecl->getNumParams() > 0) { - const ParmVarDecl * pvdFirst = kernelDecl->getParamDecl(0); - const ParmVarDecl * pvdLast = kernelDecl->getParamDecl(kernelDecl->getNumParams() - 1); - SourceLocation kernelArgListStart(pvdFirst->getLocStart()); - SourceLocation kernelArgListEnd(pvdLast->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(kernelArgListEnd, 0, *SM, DefaultLangOptions); - size_t replacementLength = SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); - initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); - OS << ", " << initialParamList; - } - DEBUG(dbgs() << "initial paramlist: " << initialParamList << "\n"); - DEBUG(dbgs() << "new paramlist: " << OS.str() << "\n"); - Replacement Rep0(*(Result.SourceManager), kernelArgListStart, replacementLength, OS.str()); - Replace->insert(Rep0); + SmallString<40> XStr; + raw_svector_ostream OS(XStr); + StringRef initialParamList; + OS << "hipLaunchParm lp"; + size_t replacementLength = OS.str().size(); + SourceLocation sl = kernelDecl->getNameInfo().getEndLoc(); + SourceLocation kernelArgListStart = clang::Lexer::findLocationAfterToken( + sl, clang::tok::l_paren, *SM, DefaultLangOptions, true); + DEBUG(dbgs() << kernelArgListStart.printToString(*SM)); + if (kernelDecl->getNumParams() > 0) { + const ParmVarDecl *pvdFirst = kernelDecl->getParamDecl(0); + const ParmVarDecl *pvdLast = + kernelDecl->getParamDecl(kernelDecl->getNumParams() - 1); + SourceLocation kernelArgListStart(pvdFirst->getLocStart()); + SourceLocation kernelArgListEnd(pvdLast->getLocEnd()); + SourceLocation stop = clang::Lexer::getLocForEndOfToken( + kernelArgListEnd, 0, *SM, DefaultLangOptions); + size_t replacementLength = + SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); + initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), + replacementLength); + OS << ", " << initialParamList; + } + DEBUG(dbgs() << "initial paramlist: " << initialParamList << "\n" + << "new paramlist: " << OS.str() << "\n"); + Replacement Rep0(*(Result.SourceManager), kernelArgListStart, + replacementLength, OS.str()); + Replace->insert(Rep0); } void run(const MatchFinder::MatchResult &Result) override { - - SourceManager * SM = Result.SourceManager; + SourceManager *SM = Result.SourceManager; LangOptions DefaultLangOptions; - if (const CallExpr * call = Result.Nodes.getNodeAs("cudaCall")) - { - const FunctionDecl * funcDcl = call->getDirectCallee(); + if (const CallExpr *call = + Result.Nodes.getNodeAs("cudaCall")) { + const FunctionDecl *funcDcl = call->getDirectCallee(); StringRef name = funcDcl->getDeclName().getAsString(); if (N.cuda2hipRename.count(name)) { StringRef repName = N.cuda2hipRename[name]; SourceLocation sl = call->getLocStart(); - Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? - SM->getImmediateSpellingLoc(sl) : sl, name.size(), repName); + Replacement Rep(*SM, SM->isMacroArgExpansion(sl) + ? SM->getImmediateSpellingLoc(sl) + : sl, + name.size(), repName); Replace->insert(Rep); } } - if (const CUDAKernelCallExpr * launchKernel = Result.Nodes.getNodeAs("cudaLaunchKernel")) - { + if (const CUDAKernelCallExpr *launchKernel = + Result.Nodes.getNodeAs( + "cudaLaunchKernel")) { SmallString<40> XStr; raw_svector_ostream OS(XStr); StringRef calleeName; - const FunctionDecl * kernelDecl = launchKernel->getDirectCallee(); + const FunctionDecl *kernelDecl = launchKernel->getDirectCallee(); if (kernelDecl) { calleeName = kernelDecl->getName(); convertKernelDecl(kernelDecl, Result); - } - else { - const Expr * e = launchKernel->getCallee(); - if (const UnresolvedLookupExpr * ule = dyn_cast(e)) { + } else { + const Expr *e = launchKernel->getCallee(); + if (const UnresolvedLookupExpr *ule = + dyn_cast(e)) { calleeName = ule->getName().getAsIdentifierInfo()->getName(); - owner->addMatcher(functionTemplateDecl(hasName(calleeName)).bind("unresolvedTemplateName"), this); + owner->addMatcher(functionTemplateDecl(hasName(calleeName)) + .bind("unresolvedTemplateName"), + this); } } - XStr.clear(); - OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << calleeName << "), "; + OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << calleeName << "),"; - const CallExpr * config = launchKernel->getConfig(); + const CallExpr *config = launchKernel->getConfig(); DEBUG(dbgs() << "Kernel config arguments:" << "\n"); - for (unsigned argno = 0; argno < config->getNumArgs(); argno++) - { - const Expr * arg = config->getArg(argno); + for (unsigned argno = 0; argno < config->getNumArgs(); argno++) { + const Expr *arg = config->getArg(argno); if (!isa(arg)) { - const ParmVarDecl * pvd = config->getDirectCallee()->getParamDecl(argno); + const ParmVarDecl *pvd = + config->getDirectCallee()->getParamDecl(argno); SourceLocation sl(arg->getLocStart()); SourceLocation el(arg->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); - StringRef outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + SourceLocation stop = + clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + StringRef outs(SM->getCharacterData(sl), + SM->getCharacterData(stop) - SM->getCharacterData(sl)); DEBUG(dbgs() << "args[ " << argno << "]" << outs << " <" - << pvd->getType().getAsString() << ">" << "\n"); + << pvd->getType().getAsString() << ">" << "\n"); if (pvd->getType().getAsString().compare("dim3") == 0) OS << " dim3(" << outs << "),"; else @@ -485,50 +493,56 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { OS << " 0,"; } - for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) - { - const Expr * arg = launchKernel->getArg(argno); + for (unsigned argno = 0; argno < launchKernel->getNumArgs(); argno++) { + const Expr *arg = launchKernel->getArg(argno); SourceLocation sl(arg->getLocStart()); SourceLocation el(arg->getLocEnd()); - SourceLocation stop = clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); - std::string outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); + SourceLocation stop = + clang::Lexer::getLocForEndOfToken(el, 0, *SM, DefaultLangOptions); + std::string outs(SM->getCharacterData(sl), + SM->getCharacterData(stop) - SM->getCharacterData(sl)); DEBUG(dbgs() << outs << "\n"); OS << " " << outs << ","; } XStr.pop_back(); OS << ")"; - size_t length = SM->getCharacterData(clang::Lexer::getLocForEndOfToken(launchKernel->getLocEnd(), 0, *SM, DefaultLangOptions)) - - SM->getCharacterData(launchKernel->getLocStart()); + size_t length = + SM->getCharacterData(clang::Lexer::getLocForEndOfToken( + launchKernel->getLocEnd(), 0, *SM, DefaultLangOptions)) - + SM->getCharacterData(launchKernel->getLocStart()); Replacement Rep(*SM, launchKernel->getLocStart(), length, OS.str()); Replace->insert(Rep); - } + } - if (const FunctionTemplateDecl * templateDecl = Result.Nodes.getNodeAs("unresolvedTemplateName")) - { - FunctionDecl * kernelDecl = templateDecl->getTemplatedDecl(); + if (const FunctionTemplateDecl *templateDecl = + Result.Nodes.getNodeAs( + "unresolvedTemplateName")) { + FunctionDecl *kernelDecl = templateDecl->getTemplatedDecl(); convertKernelDecl(kernelDecl, Result); } - if (const MemberExpr * threadIdx = Result.Nodes.getNodeAs("cudaBuiltin")) - { - if (const OpaqueValueExpr * refBase = dyn_cast(threadIdx->getBase())) { - if (const DeclRefExpr * declRef = dyn_cast(refBase->getSourceExpr())) { - StringRef name = declRef->getDecl()->getName(); - StringRef memberName = threadIdx->getMemberDecl()->getName(); - size_t pos = memberName.find_first_not_of("__fetch_builtin_"); - memberName = memberName.slice(pos, memberName.size()); - SmallString<128> tmpData; - name = Twine(name+"."+memberName).toStringRef(tmpData); - StringRef repName = N.cuda2hipRename[name]; - SourceLocation sl = threadIdx->getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); + if (const MemberExpr *threadIdx = + Result.Nodes.getNodeAs("cudaBuiltin")) { + if (const OpaqueValueExpr *refBase = + dyn_cast(threadIdx->getBase())) { + if (const DeclRefExpr *declRef = + dyn_cast(refBase->getSourceExpr())) { + StringRef name = declRef->getDecl()->getName(); + StringRef memberName = threadIdx->getMemberDecl()->getName(); + size_t pos = memberName.find_first_not_of("__fetch_builtin_"); + memberName = memberName.slice(pos, memberName.size()); + SmallString<128> tmpData; + name = Twine(name + "." + memberName).toStringRef(tmpData); + StringRef repName = N.cuda2hipRename[name]; + SourceLocation sl = threadIdx->getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); } - } - } + } + } - if (const DeclRefExpr * cudaEnumConstantRef = Result.Nodes.getNodeAs("cudaEnumConstantRef")) - { + if (const DeclRefExpr *cudaEnumConstantRef = + Result.Nodes.getNodeAs("cudaEnumConstantRef")) { StringRef name = cudaEnumConstantRef->getDecl()->getNameAsString(); StringRef repName = N.cuda2hipRename[name]; SourceLocation sl = cudaEnumConstantRef->getLocStart(); @@ -536,18 +550,22 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { Replace->insert(Rep); } - if (const VarDecl * cudaEnumConstantDecl = Result.Nodes.getNodeAs("cudaEnumConstantDecl")) - { - StringRef name = cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); + if (const VarDecl *cudaEnumConstantDecl = + Result.Nodes.getNodeAs("cudaEnumConstantDecl")) { + StringRef name = + cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); StringRef repName = N.cuda2hipRename[name]; SourceLocation sl = cudaEnumConstantDecl->getLocStart(); Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); } - if (const VarDecl * cudaStructVar = Result.Nodes.getNodeAs("cudaStructVar")) - { - StringRef name = cudaStructVar->getType()->getAsStructureType()->getDecl()->getNameAsString(); + if (const VarDecl *cudaStructVar = + Result.Nodes.getNodeAs("cudaStructVar")) { + StringRef name = cudaStructVar->getType() + ->getAsStructureType() + ->getDecl() + ->getNameAsString(); StringRef repName = N.cuda2hipRename[name]; TypeLoc TL = cudaStructVar->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); @@ -555,9 +573,9 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { Replace->insert(Rep); } - if (const VarDecl * cudaStructVarPtr = Result.Nodes.getNodeAs("cudaStructVarPtr")) - { - const Type * t = cudaStructVarPtr->getType().getTypePtrOrNull(); + if (const VarDecl *cudaStructVarPtr = + Result.Nodes.getNodeAs("cudaStructVarPtr")) { + const Type *t = cudaStructVarPtr->getType().getTypePtrOrNull(); if (t) { StringRef name = t->getPointeeCXXRecordDecl()->getName(); StringRef repName = N.cuda2hipRename[name]; @@ -568,12 +586,11 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { } } - - if (const ParmVarDecl * cudaParamDecl = Result.Nodes.getNodeAs("cudaParamDecl")) - { + if (const ParmVarDecl *cudaParamDecl = + Result.Nodes.getNodeAs("cudaParamDecl")) { QualType QT = cudaParamDecl->getOriginalType().getUnqualifiedType(); StringRef name = QT.getAsString(); - const Type * t = QT.getTypePtr(); + const Type *t = QT.getTypePtr(); if (t->isStructureOrClassType()) { name = t->getAsCXXRecordDecl()->getName(); } @@ -584,14 +601,15 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { Replace->insert(Rep); } - if (const ParmVarDecl * cudaParamDeclPtr = Result.Nodes.getNodeAs("cudaParamDeclPtr")) - { - const Type * pt = cudaParamDeclPtr->getType().getTypePtrOrNull(); + if (const ParmVarDecl *cudaParamDeclPtr = + Result.Nodes.getNodeAs("cudaParamDeclPtr")) { + const Type *pt = cudaParamDeclPtr->getType().getTypePtrOrNull(); if (pt) { QualType QT = pt->getPointeeType(); - const Type * t = QT.getTypePtr(); - StringRef name = t->isStructureOrClassType()? - t->getAsCXXRecordDecl()->getName() : StringRef(QT.getAsString()); + const Type *t = QT.getTypePtr(); + StringRef name = t->isStructureOrClassType() + ? t->getAsCXXRecordDecl()->getName() + : StringRef(QT.getAsString()); StringRef repName = N.cuda2hipRename[name]; TypeLoc TL = cudaParamDeclPtr->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); @@ -600,20 +618,20 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { } } - - if (const StringLiteral * stringLiteral = Result.Nodes.getNodeAs("stringLiteral")) - { + if (const StringLiteral *stringLiteral = + Result.Nodes.getNodeAs("stringLiteral")) { if (stringLiteral->getCharByteWidth() == 1) { StringRef s = stringLiteral->getString(); processString(s, N, Replace, *SM, stringLiteral->getLocStart()); } } - if (const UnaryExprOrTypeTraitExpr * expr = Result.Nodes.getNodeAs("cudaStructSizeOf")) - { - TypeSourceInfo * typeInfo = expr->getArgumentTypeInfo(); + if (const UnaryExprOrTypeTraitExpr *expr = + Result.Nodes.getNodeAs( + "cudaStructSizeOf")) { + TypeSourceInfo *typeInfo = expr->getArgumentTypeInfo(); QualType QT = typeInfo->getType().getUnqualifiedType(); - const Type * type = QT.getTypePtr(); + const Type *type = QT.getTypePtr(); StringRef name = type->getAsCXXRecordDecl()->getName(); StringRef repName = N.cuda2hipRename[name]; TypeLoc TL = typeInfo->getTypeLoc(); @@ -623,27 +641,29 @@ class Cuda2HipCallback : public MatchFinder::MatchCallback { } } - private: +private: Replacements *Replace; - ast_matchers::MatchFinder * owner; + ast_matchers::MatchFinder *owner; struct hipName N; }; } // end anonymous namespace // Set up the command line options -static cl::OptionCategory ToolTemplateCategory("CUDA to HIP source translator options"); -static cl::extrahelp MoreHelp( " specify the path of source file\n\n" ); +static cl::OptionCategory + ToolTemplateCategory("CUDA to HIP source translator options"); +static cl::extrahelp MoreHelp(" specify the path of source file\n\n"); -static cl::opt -OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::cat(ToolTemplateCategory)); - -//static cl::opt -//Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(llvm::DebugFlag)); +static cl::opt OutputFilename("o", cl::desc("Output filename"), + cl::value_desc("filename"), + cl::cat(ToolTemplateCategory)); static cl::opt -Inplace("inplace", cl::desc("Modify input file inplace, replacing input with hipified output, save backup in .prehip file. " - "If .prehip file exists, use that as input to hip."), cl::value_desc("inplace"), cl::cat(ToolTemplateCategory)); + Inplace("inplace", + cl::desc("Modify input file inplace, replacing input with hipified " + "output, save backup in .prehip file. " + "If .prehip file exists, use that as input to hip."), + cl::value_desc("inplace"), cl::cat(ToolTemplateCategory)); int main(int argc, const char **argv) { @@ -651,7 +671,8 @@ int main(int argc, const char **argv) { int Result; - CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory, llvm::cl::Required); + CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory, + llvm::cl::Required); std::string dst = OutputFilename; std::vector fileSources = OptionsParser.getSourcePathList(); if (dst.empty()) { @@ -673,7 +694,7 @@ int main(int argc, const char **argv) { } std::ifstream source(fileSources[0], std::ios::binary); - std::ofstream dest(Inplace ? dst+".prehip" : dst, std::ios::binary); + std::ofstream dest(Inplace ? dst + ".prehip" : dst, std::ios::binary); dest << source.rdbuf(); source.close(); dest.close(); @@ -682,17 +703,49 @@ int main(int argc, const char **argv) { ast_matchers::MatchFinder Finder; Cuda2HipCallback Callback(&Tool.getReplacements(), &Finder); HipifyPPCallbacks PPCallbacks(&Tool.getReplacements()); - Finder.addMatcher(callExpr(isExpansionInMainFile(), callee(functionDecl(matchesName("cuda.*")))).bind("cudaCall"), &Callback); + Finder.addMatcher(callExpr(isExpansionInMainFile(), + callee(functionDecl(matchesName("cuda.*")))) + .bind("cudaCall"), + &Callback); Finder.addMatcher(cudaKernelCallExpr().bind("cudaLaunchKernel"), &Callback); - Finder.addMatcher(memberExpr(isExpansionInMainFile(), hasObjectExpression(hasType(cxxRecordDecl(matchesName("__cuda_builtin_"))))).bind("cudaBuiltin"), &Callback); - Finder.addMatcher(declRefExpr(isExpansionInMainFile(), to(enumConstantDecl(matchesName("cuda.*")))).bind("cudaEnumConstantRef"), &Callback); - Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(enumDecl(matchesName("cuda.*")))).bind("cudaEnumConstantDecl"), &Callback); - Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(cxxRecordDecl(matchesName("cuda.*")))).bind("cudaStructVar"), &Callback); - Finder.addMatcher(varDecl(isExpansionInMainFile(), hasType(pointsTo(cxxRecordDecl(matchesName("cuda.*"))))).bind("cudaStructVarPtr"), &Callback); - Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(namedDecl(matchesName("cuda.*")))).bind("cudaParamDecl"), &Callback); - Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), hasType(pointsTo(namedDecl(matchesName("cuda.*"))))).bind("cudaParamDeclPtr"), &Callback); - Finder.addMatcher(expr(isExpansionInMainFile(), sizeOfExpr(hasArgumentOfType(recordType(hasDeclaration(cxxRecordDecl(matchesName("cuda.*"))))))).bind("cudaStructSizeOf"), &Callback); - Finder.addMatcher(stringLiteral(isExpansionInMainFile()).bind("stringLiteral"), &Callback); + Finder.addMatcher(memberExpr(isExpansionInMainFile(), + hasObjectExpression(hasType(cxxRecordDecl( + matchesName("__cuda_builtin_"))))) + .bind("cudaBuiltin"), + &Callback); + Finder.addMatcher(declRefExpr(isExpansionInMainFile(), + to(enumConstantDecl(matchesName("cuda.*")))) + .bind("cudaEnumConstantRef"), + &Callback); + Finder.addMatcher( + varDecl(isExpansionInMainFile(), hasType(enumDecl(matchesName("cuda.*")))) + .bind("cudaEnumConstantDecl"), + &Callback); + Finder.addMatcher(varDecl(isExpansionInMainFile(), + hasType(cxxRecordDecl(matchesName("cuda.*")))) + .bind("cudaStructVar"), + &Callback); + Finder.addMatcher( + varDecl(isExpansionInMainFile(), + hasType(pointsTo(cxxRecordDecl(matchesName("cuda.*"))))) + .bind("cudaStructVarPtr"), + &Callback); + Finder.addMatcher(parmVarDecl(isExpansionInMainFile(), + hasType(namedDecl(matchesName("cuda.*")))) + .bind("cudaParamDecl"), + &Callback); + Finder.addMatcher( + parmVarDecl(isExpansionInMainFile(), + hasType(pointsTo(namedDecl(matchesName("cuda.*"))))) + .bind("cudaParamDeclPtr"), + &Callback); + Finder.addMatcher(expr(isExpansionInMainFile(), + sizeOfExpr(hasArgumentOfType(recordType(hasDeclaration( + cxxRecordDecl(matchesName("cuda.*"))))))) + .bind("cudaStructSizeOf"), + &Callback); + Finder.addMatcher( + stringLiteral(isExpansionInMainFile()).bind("stringLiteral"), &Callback); auto action = newFrontendActionFactory(&Finder, &PPCallbacks); @@ -700,12 +753,13 @@ int main(int argc, const char **argv) { compilationStages.push_back("--cuda-host-only"); compilationStages.push_back("--cuda-device-only"); - for (auto Stage : compilationStages) - { - Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster(Stage, ArgumentInsertPosition::BEGIN)); + for (auto Stage : compilationStages) { + Tool.appendArgumentsAdjuster( + getInsertArgumentAdjuster(Stage, ArgumentInsertPosition::BEGIN)); Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster("-std=c++11")); #if defined(HIPIFY_CLANG_RES) - Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster("-resource-dir=" HIPIFY_CLANG_RES)); + Tool.appendArgumentsAdjuster( + getInsertArgumentAdjuster("-resource-dir=" HIPIFY_CLANG_RES)); #endif // defined(HIPIFY_CLANG_HEADERS) Tool.appendArgumentsAdjuster(getClangSyntaxOnlyAdjuster()); Result = Tool.run(action.get()); @@ -717,8 +771,8 @@ int main(int argc, const char **argv) { IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), &*DiagOpts); DiagnosticsEngine Diagnostics( - IntrusiveRefCntPtr(new DiagnosticIDs()), - &*DiagOpts, &DiagnosticPrinter, false); + IntrusiveRefCntPtr(new DiagnosticIDs()), &*DiagOpts, + &DiagnosticPrinter, false); SourceManager Sources(Diagnostics, Tool.getFiles()); DEBUG(dbgs() << "Replacements collected by the tool:\n"); @@ -736,8 +790,7 @@ int main(int argc, const char **argv) { if (!Inplace) { size_t pos = dst.rfind(".cu"); - if (pos != std::string::npos) - { + if (pos != std::string::npos) { rename(dst.c_str(), dst.substr(0, pos).c_str()); } } From d94c7a3347ebb83be1cfa6f1710c6deba8a91593 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Thu, 24 Mar 2016 19:31:42 +0300 Subject: [PATCH 35/82] 1. added stubs for options -no-output, -print-stats 2. preparations for stats collection --- src/Cuda2Hip.cpp | 311 ++++++++++++++++++++++++++--------------------- 1 file changed, 174 insertions(+), 137 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index db8527835f..a78a35a3ab 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -55,183 +55,211 @@ using namespace llvm; #define DEBUG_TYPE "cuda2hip" namespace { -struct hipName { - hipName() { + +enum ConvTypes { + CONV_DEV = 0, + CONV_MEM, + CONV_KERN, + CONV_COORD_FUNC, + CONV_MATH_FUNC, + CONV_SPECIAL_FUNC, + CONV_STREAM, + CONV_EVENT, + CONV_ERR, + CONV_DEF, + CONV_TEX, + CONV_OTHER, + CONV_INC, + CONV_LAST +} ; + +struct cuda2hipMap { + cuda2hipMap() { // defines - cuda2hipRename["__CUDACC__"] = "__HIPCC__"; + cuda2hipRename["__CUDACC__"] = {"__HIPCC__", CONV_DEF}; // includes - cuda2hipRename["cuda_runtime.h"] = "hip_runtime.h"; - cuda2hipRename["cuda_runtime_api.h"] = "hip_runtime_api.h"; + cuda2hipRename["cuda_runtime.h"] = {"hip_runtime.h", CONV_INC}; + cuda2hipRename["cuda_runtime_api.h"] = {"hip_runtime_api.h", CONV_INC}; // Error codes and return types: - cuda2hipRename["cudaError_t"] = "hipError_t"; - cuda2hipRename["cudaError"] = "hipError"; - cuda2hipRename["cudaSuccess"] = "hipSuccess"; + cuda2hipRename["cudaError_t"] = {"hipError_t", CONV_ERR}; + cuda2hipRename["cudaError"] = {"hipError", CONV_ERR}; + cuda2hipRename["cudaSuccess"] = {"hipSuccess", CONV_ERR}; - cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; - cuda2hipRename["cudaErrorMemoryAllocation"] = "hipErrorMemoryAllocation"; - cuda2hipRename["cudaErrorMemoryFree"] = "hipErrorMemoryFree"; - cuda2hipRename["cudaErrorUnknownSymbol"] = "hipErrorUnknownSymbol"; - cuda2hipRename["cudaErrorOutOfResources"] = "hipErrorOutOfResources"; - cuda2hipRename["cudaErrorInvalidValue"] = "hipErrorInvalidValue"; + cuda2hipRename["cudaErrorUnknown"] = {"hipErrorUnknown", CONV_ERR}; + cuda2hipRename["cudaErrorMemoryAllocation"] = {"hipErrorMemoryAllocation", CONV_ERR}; + cuda2hipRename["cudaErrorMemoryFree"] = {"hipErrorMemoryFree", CONV_ERR}; + cuda2hipRename["cudaErrorUnknownSymbol"] = {"hipErrorUnknownSymbol", CONV_ERR}; + cuda2hipRename["cudaErrorOutOfResources"] = {"hipErrorOutOfResources", CONV_ERR}; + cuda2hipRename["cudaErrorInvalidValue"] = {"hipErrorInvalidValue", CONV_ERR}; cuda2hipRename["cudaErrorInvalidResourceHandle"] = - "hipErrorInvalidResourceHandle"; - cuda2hipRename["cudaErrorInvalidDevice"] = "hipErrorInvalidDevice"; - cuda2hipRename["cudaErrorNoDevice"] = "hipErrorNoDevice"; - cuda2hipRename["cudaErrorNotReady"] = "hipErrorNotReady"; - cuda2hipRename["cudaErrorUnknown"] = "hipErrorUnknown"; + {"hipErrorInvalidResourceHandle", CONV_ERR}; + cuda2hipRename["cudaErrorInvalidDevice"] = {"hipErrorInvalidDevice", CONV_ERR}; + cuda2hipRename["cudaErrorNoDevice"] = {"hipErrorNoDevice", CONV_ERR}; + cuda2hipRename["cudaErrorNotReady"] = {"hipErrorNotReady", CONV_ERR}; + cuda2hipRename["cudaErrorUnknown"] = {"hipErrorUnknown", CONV_ERR}; // error APIs: - cuda2hipRename["cudaGetLastError"] = "hipGetLastError"; - cuda2hipRename["cudaPeekAtLastError"] = "hipPeekAtLastError"; - cuda2hipRename["cudaGetErrorName"] = "hipGetErrorName"; - cuda2hipRename["cudaGetErrorString"] = "hipGetErrorString"; + cuda2hipRename["cudaGetLastError"] = {"hipGetLastError", CONV_ERR}; + cuda2hipRename["cudaPeekAtLastError"] = {"hipPeekAtLastError", CONV_ERR}; + cuda2hipRename["cudaGetErrorName"] = {"hipGetErrorName", CONV_ERR}; + cuda2hipRename["cudaGetErrorString"] = {"hipGetErrorString", CONV_ERR}; // Memcpy - cuda2hipRename["cudaMemcpy"] = "hipMemcpy"; - cuda2hipRename["cudaMemcpyHostToHost"] = "hipMemcpyHostToHost"; - cuda2hipRename["cudaMemcpyHostToDevice"] = "hipMemcpyHostToDevice"; - cuda2hipRename["cudaMemcpyDeviceToHost"] = "hipMemcpyDeviceToHost"; - cuda2hipRename["cudaMemcpyDeviceToDevice"] = "hipMemcpyDeviceToDevice"; - cuda2hipRename["cudaMemcpyDefault"] = "hipMemcpyDefault"; - cuda2hipRename["cudaMemcpyToSymbol"] = "hipMemcpyToSymbol"; - cuda2hipRename["cudaMemset"] = "hipMemset"; - cuda2hipRename["cudaMemsetAsync"] = "hipMemsetAsync"; - cuda2hipRename["cudaMemcpyAsync"] = "hipMemcpyAsync"; - cuda2hipRename["cudaMemGetInfo"] = "hipMemGetInfo"; - cuda2hipRename["cudaMemcpyKind"] = "hipMemcpyKind"; + cuda2hipRename["cudaMemcpy"] = {"hipMemcpy", CONV_MEM}; + cuda2hipRename["cudaMemcpyHostToHost"] = {"hipMemcpyHostToHost", CONV_MEM}; + cuda2hipRename["cudaMemcpyHostToDevice"] = {"hipMemcpyHostToDevice", CONV_MEM}; + cuda2hipRename["cudaMemcpyDeviceToHost"] = {"hipMemcpyDeviceToHost", CONV_MEM}; + cuda2hipRename["cudaMemcpyDeviceToDevice"] = {"hipMemcpyDeviceToDevice", CONV_MEM}; + cuda2hipRename["cudaMemcpyDefault"] = {"hipMemcpyDefault", CONV_MEM}; + cuda2hipRename["cudaMemcpyToSymbol"] = {"hipMemcpyToSymbol", CONV_MEM}; + cuda2hipRename["cudaMemset"] = {"hipMemset", CONV_MEM}; + cuda2hipRename["cudaMemsetAsync"] = {"hipMemsetAsync", CONV_MEM}; + cuda2hipRename["cudaMemcpyAsync"] = {"hipMemcpyAsync", CONV_MEM}; + cuda2hipRename["cudaMemGetInfo"] = {"hipMemGetInfo", CONV_MEM}; + cuda2hipRename["cudaMemcpyKind"] = {"hipMemcpyKind", CONV_MEM}; // Memory management : - cuda2hipRename["cudaMalloc"] = "hipMalloc"; - cuda2hipRename["cudaMallocHost"] = "hipHostAlloc"; - cuda2hipRename["cudaFree"] = "hipFree"; - cuda2hipRename["cudaFreeHost"] = "hipHostFree"; + cuda2hipRename["cudaMalloc"] = {"hipMalloc", CONV_MEM}; + cuda2hipRename["cudaMallocHost"] = {"hipHostAlloc", CONV_MEM}; + cuda2hipRename["cudaFree"] = {"hipFree", CONV_MEM}; + cuda2hipRename["cudaFreeHost"] = {"hipHostFree", CONV_MEM}; // Coordinate Indexing and Dimensions: - cuda2hipRename["threadIdx.x"] = "hipThreadIdx_x"; - cuda2hipRename["threadIdx.y"] = "hipThreadIdx_y"; - cuda2hipRename["threadIdx.z"] = "hipThreadIdx_z"; + cuda2hipRename["threadIdx.x"] = {"hipThreadIdx_x", CONV_COORD_FUNC}; + cuda2hipRename["threadIdx.y"] = {"hipThreadIdx_y", CONV_COORD_FUNC}; + cuda2hipRename["threadIdx.z"] = {"hipThreadIdx_z", CONV_COORD_FUNC}; - cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; - cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; - cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; + cuda2hipRename["blockIdx.x"] = {"hipBlockIdx_x", CONV_COORD_FUNC}; + cuda2hipRename["blockIdx.y"] = {"hipBlockIdx_y", CONV_COORD_FUNC}; + cuda2hipRename["blockIdx.z"] = {"hipBlockIdx_z", CONV_COORD_FUNC}; - cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; - cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; - cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; + cuda2hipRename["blockDim.x"] = {"hipBlockDim_x", CONV_COORD_FUNC}; + cuda2hipRename["blockDim.y"] = {"hipBlockDim_y", CONV_COORD_FUNC}; + cuda2hipRename["blockDim.z"] = {"hipBlockDim_z", CONV_COORD_FUNC}; - cuda2hipRename["gridDim.x"] = "hipGridDim_x"; - cuda2hipRename["gridDim.y"] = "hipGridDim_y"; - cuda2hipRename["gridDim.z"] = "hipGridDim_z"; + cuda2hipRename["gridDim.x"] = {"hipGridDim_x", CONV_COORD_FUNC}; + cuda2hipRename["gridDim.y"] = {"hipGridDim_y", CONV_COORD_FUNC}; + cuda2hipRename["gridDim.z"] = {"hipGridDim_z", CONV_COORD_FUNC}; - cuda2hipRename["blockIdx.x"] = "hipBlockIdx_x"; - cuda2hipRename["blockIdx.y"] = "hipBlockIdx_y"; - cuda2hipRename["blockIdx.z"] = "hipBlockIdx_z"; + cuda2hipRename["blockIdx.x"] = {"hipBlockIdx_x", CONV_COORD_FUNC}; + cuda2hipRename["blockIdx.y"] = {"hipBlockIdx_y", CONV_COORD_FUNC}; + cuda2hipRename["blockIdx.z"] = {"hipBlockIdx_z", CONV_COORD_FUNC}; - cuda2hipRename["blockDim.x"] = "hipBlockDim_x"; - cuda2hipRename["blockDim.y"] = "hipBlockDim_y"; - cuda2hipRename["blockDim.z"] = "hipBlockDim_z"; + cuda2hipRename["blockDim.x"] = {"hipBlockDim_x", CONV_COORD_FUNC}; + cuda2hipRename["blockDim.y"] = {"hipBlockDim_y", CONV_COORD_FUNC}; + cuda2hipRename["blockDim.z"] = {"hipBlockDim_z", CONV_COORD_FUNC}; - cuda2hipRename["gridDim.x"] = "hipGridDim_x"; - cuda2hipRename["gridDim.y"] = "hipGridDim_y"; - cuda2hipRename["gridDim.z"] = "hipGridDim_z"; + cuda2hipRename["gridDim.x"] = {"hipGridDim_x", CONV_COORD_FUNC}; + cuda2hipRename["gridDim.y"] = {"hipGridDim_y", CONV_COORD_FUNC}; + cuda2hipRename["gridDim.z"] = {"hipGridDim_z", CONV_COORD_FUNC}; - cuda2hipRename["warpSize"] = "hipWarpSize"; + cuda2hipRename["warpSize"] = {"hipWarpSize", CONV_SPECIAL_FUNC}; // Events - cuda2hipRename["cudaEvent_t"] = "hipEvent_t"; - cuda2hipRename["cudaEventCreate"] = "hipEventCreate"; - cuda2hipRename["cudaEventCreateWithFlags"] = "hipEventCreateWithFlags"; - cuda2hipRename["cudaEventDestroy"] = "hipEventDestroy"; - cuda2hipRename["cudaEventRecord"] = "hipEventRecord"; - cuda2hipRename["cudaEventElapsedTime"] = "hipEventElapsedTime"; - cuda2hipRename["cudaEventSynchronize"] = "hipEventSynchronize"; + cuda2hipRename["cudaEvent_t"] = {"hipEvent_t", CONV_EVENT}; + cuda2hipRename["cudaEventCreate"] = {"hipEventCreate", CONV_EVENT}; + cuda2hipRename["cudaEventCreateWithFlags"] = {"hipEventCreateWithFlags", CONV_EVENT}; + cuda2hipRename["cudaEventDestroy"] = {"hipEventDestroy", CONV_EVENT}; + cuda2hipRename["cudaEventRecord"] = {"hipEventRecord", CONV_EVENT}; + cuda2hipRename["cudaEventElapsedTime"] = {"hipEventElapsedTime", CONV_EVENT}; + cuda2hipRename["cudaEventSynchronize"] = {"hipEventSynchronize", CONV_EVENT}; // Streams - cuda2hipRename["cudaStream_t"] = "hipStream_t"; - cuda2hipRename["cudaStreamCreate"] = "hipStreamCreate"; - cuda2hipRename["cudaStreamCreateWithFlags"] = "hipStreamCreateWithFlags"; - cuda2hipRename["cudaStreamDestroy"] = "hipStreamDestroy"; - cuda2hipRename["cudaStreamWaitEvent"] = "hipStreamWaitEven"; - cuda2hipRename["cudaStreamSynchronize"] = "hipStreamSynchronize"; - cuda2hipRename["cudaStreamDefault"] = "hipStreamDefault"; - cuda2hipRename["cudaStreamNonBlocking"] = "hipStreamNonBlocking"; + cuda2hipRename["cudaStream_t"] = {"hipStream_t", CONV_STREAM}; + cuda2hipRename["cudaStreamCreate"] = {"hipStreamCreate", CONV_STREAM}; + cuda2hipRename["cudaStreamCreateWithFlags"] = {"hipStreamCreateWithFlags", CONV_STREAM}; + cuda2hipRename["cudaStreamDestroy"] = {"hipStreamDestroy", CONV_STREAM}; + cuda2hipRename["cudaStreamWaitEvent"] = {"hipStreamWaitEven", CONV_STREAM}; + cuda2hipRename["cudaStreamSynchronize"] = {"hipStreamSynchronize", CONV_STREAM}; + cuda2hipRename["cudaStreamDefault"] = {"hipStreamDefault", CONV_STREAM}; + cuda2hipRename["cudaStreamNonBlocking"] = {"hipStreamNonBlocking", CONV_STREAM}; // Other synchronization - cuda2hipRename["cudaDeviceSynchronize"] = "hipDeviceSynchronize"; + cuda2hipRename["cudaDeviceSynchronize"] = {"hipDeviceSynchronize", CONV_DEV}; cuda2hipRename["cudaThreadSynchronize"] = - "hipDeviceSynchronize"; // translate deprecated cudaThreadSynchronize - cuda2hipRename["cudaDeviceReset"] = "hipDeviceReset"; + {"hipDeviceSynchronize", CONV_DEV}; // translate deprecated cudaThreadSynchronize + cuda2hipRename["cudaDeviceReset"] = {"hipDeviceReset", CONV_DEV}; cuda2hipRename["cudaThreadExit"] = - "hipDeviceReset"; // translate deprecated cudaThreadExit - cuda2hipRename["cudaSetDevice"] = "hipSetDevice"; - cuda2hipRename["cudaGetDevice"] = "hipGetDevice"; + {"hipDeviceReset", CONV_DEV}; // translate deprecated cudaThreadExit + cuda2hipRename["cudaSetDevice"] = {"hipSetDevice", CONV_DEV}; + cuda2hipRename["cudaGetDevice"] = {"hipGetDevice", CONV_DEV}; + // Attribute + cuda2hipRename["bcudaDeviceAttr"] = {"hipDeviceAttribute_t", CONV_DEV}; + cuda2hipRename["bcudaDeviceGetAttribute"] = {"hipDeviceGetAttribute", CONV_DEV}; + // Device - cuda2hipRename["cudaDeviceProp"] = "hipDeviceProp_t"; - cuda2hipRename["cudaGetDeviceProperties"] = "hipDeviceGetProperties"; + cuda2hipRename["cudaDeviceProp"] = {"hipDeviceProp_t", CONV_DEV}; + cuda2hipRename["cudaGetDeviceProperties"] = {"hipDeviceGetProperties", CONV_DEV}; // Cache config - cuda2hipRename["cudaDeviceSetCacheConfig"] = "hipDeviceSetCacheConfig"; + cuda2hipRename["cudaDeviceSetCacheConfig"] = {"hipDeviceSetCacheConfig", CONV_DEV}; cuda2hipRename["cudaThreadSetCacheConfig"] = - "hipDeviceSetCacheConfig"; // translate deprecated - cuda2hipRename["cudaDeviceGetCacheConfig"] = "hipDeviceGetCacheConfig"; + {"hipDeviceSetCacheConfig", CONV_DEV}; // translate deprecated + cuda2hipRename["cudaDeviceGetCacheConfig"] = {"hipDeviceGetCacheConfig", CONV_DEV}; cuda2hipRename["cudaThreadGetCacheConfig"] = - "hipDeviceGetCacheConfig"; // translate deprecated - cuda2hipRename["cudaFuncCache"] = "hipFuncCache"; - cuda2hipRename["cudaFuncCachePreferNone"] = "hipFuncCachePreferNone"; - cuda2hipRename["cudaFuncCachePreferShared"] = "hipFuncCachePreferShared"; - cuda2hipRename["cudaFuncCachePreferL1"] = "hipFuncCachePreferL1"; - cuda2hipRename["cudaFuncCachePreferEqual"] = "hipFuncCachePreferEqual"; + {"hipDeviceGetCacheConfig", CONV_DEV}; // translate deprecated + cuda2hipRename["cudaFuncCache"] = {"hipFuncCache", CONV_DEV}; + cuda2hipRename["cudaFuncCachePreferNone"] = {"hipFuncCachePreferNone", CONV_DEV}; + cuda2hipRename["cudaFuncCachePreferShared"] = {"hipFuncCachePreferShared", CONV_DEV}; + cuda2hipRename["cudaFuncCachePreferL1"] = {"hipFuncCachePreferL1", CONV_DEV}; + cuda2hipRename["cudaFuncCachePreferEqual"] = {"hipFuncCachePreferEqual", CONV_DEV}; // function - cuda2hipRename["cudaFuncSetCacheConfig"] = "hipFuncSetCacheConfig"; + cuda2hipRename["cudaFuncSetCacheConfig"] = {"hipFuncSetCacheConfig", CONV_DEV}; - cuda2hipRename["cudaDriverGetVersion"] = "hipDriverGetVersion"; - cuda2hipRename["cudaRuntimeGetVersion"] = "hipRuntimeGetVersion"; + cuda2hipRename["cudaDriverGetVersion"] = {"hipDriverGetVersion", CONV_DEV}; +// cuda2hipRename["cudaRuntimeGetVersion"] = {"hipRuntimeGetVersion", CONV_DEV}; // Peer2Peer - cuda2hipRename["cudaDeviceCanAccessPeer"] = "hipDeviceCanAccessPeer"; + cuda2hipRename["cudaDeviceCanAccessPeer"] = {"hipDeviceCanAccessPeer", CONV_DEV}; cuda2hipRename["cudaDeviceDisablePeerAccess"] = - "hipDeviceDisablePeerAccess"; - cuda2hipRename["cudaDeviceEnablePeerAccess"] = "hipDeviceEnablePeerAccess"; - cuda2hipRename["cudaMemcpyPeerAsync"] = "hipMemcpyPeerAsync"; - cuda2hipRename["cudaMemcpyPeer"] = "hipMemcpyPeer"; + {"hipDeviceDisablePeerAccess", CONV_DEV}; + cuda2hipRename["cudaDeviceEnablePeerAccess"] = {"hipDeviceEnablePeerAccess", CONV_DEV}; + cuda2hipRename["cudaMemcpyPeerAsync"] = {"hipMemcpyPeerAsync", CONV_MEM}; + cuda2hipRename["cudaMemcpyPeer"] = {"hipMemcpyPeer", CONV_MEM}; // Shared mem: cuda2hipRename["cudaDeviceSetSharedMemConfig"] = - "hipDeviceSetSharedMemConfig"; + {"hipDeviceSetSharedMemConfig", CONV_DEV}; cuda2hipRename["cudaThreadSetSharedMemConfig"] = - "hipDeviceSetSharedMemConfig"; // translate deprecated + {"hipDeviceSetSharedMemConfig", CONV_DEV}; // translate deprecated cuda2hipRename["cudaDeviceGetSharedMemConfig"] = - "hipDeviceGetSharedMemConfig"; + {"hipDeviceGetSharedMemConfig", CONV_DEV}; cuda2hipRename["cudaThreadGetSharedMemConfig"] = - "hipDeviceGetSharedMemConfig"; // translate deprecated - cuda2hipRename["cudaSharedMemConfig"] = "hipSharedMemConfig"; + {"hipDeviceGetSharedMemConfig", CONV_DEV}; // translate deprecated + cuda2hipRename["cudaSharedMemConfig"] = {"hipSharedMemConfig", CONV_DEV}; cuda2hipRename["cudaSharedMemBankSizeDefault"] = - "hipSharedMemBankSizeDefault"; + {"hipSharedMemBankSizeDefault", CONV_DEV}; cuda2hipRename["cudaSharedMemBankSizeFourByte"] = - "hipSharedMemBankSizeFourByte"; + {"hipSharedMemBankSizeFourByte", CONV_DEV}; cuda2hipRename["cudaSharedMemBankSizeEightByte"] = - "hipSharedMemBankSizeEightByte"; + {"hipSharedMemBankSizeEightByte", CONV_DEV}; - cuda2hipRename["cudaGetDeviceCount"] = "hipGetDeviceCount"; + cuda2hipRename["cudaGetDeviceCount"] = {"hipGetDeviceCount", CONV_DEV}; // Profiler // cuda2hipRename["cudaProfilerInitialize"] = "hipProfilerInitialize"; // // see if these are called anywhere. - cuda2hipRename["cudaProfilerStart"] = "hipProfilerStart"; - cuda2hipRename["cudaProfilerStop"] = "hipProfilerStop"; + cuda2hipRename["cudaProfilerStart"] = {"hipProfilerStart", CONV_OTHER}; + cuda2hipRename["cudaProfilerStop"] = {"hipProfilerStop", CONV_OTHER}; - cuda2hipRename["cudaChannelFormatDesc"] = "hipChannelFormatDesc"; - cuda2hipRename["cudaFilterModePoint"] = "hipFilterModePoint"; - cuda2hipRename["cudaReadModeElementType"] = "hipReadModeElementType"; + cuda2hipRename["cudaChannelFormatDesc"] = {"hipChannelFormatDesc", CONV_TEX}; + cuda2hipRename["cudaFilterModePoint"] = {"hipFilterModePoint", CONV_TEX}; + cuda2hipRename["cudaReadModeElementType"] = {"hipReadModeElementType", CONV_TEX}; - cuda2hipRename["cudaCreateChannelDesc"] = "hipCreateChannelDesc"; - cuda2hipRename["cudaBindTexture"] = "hipBindTexture"; - cuda2hipRename["cudaUnbindTexture"] = "hipUnbindTexture"; + cuda2hipRename["cudaCreateChannelDesc"] = {"hipCreateChannelDesc", CONV_TEX}; + cuda2hipRename["cudaBindTexture"] = {"hipBindTexture", CONV_TEX}; + cuda2hipRename["cudaUnbindTexture"] = {"hipUnbindTexture", CONV_TEX}; } - DenseMap cuda2hipRename; + + struct HipNames { + StringRef hipName; + ConvTypes countType; + }; + + SmallDenseMap cuda2hipRename; }; StringRef unquoteStr(StringRef s) { @@ -240,13 +268,13 @@ StringRef unquoteStr(StringRef s) { return s; } -void processString(StringRef s, struct hipName &map, Replacements *Replace, +static void processString(StringRef s, struct cuda2hipMap &map, Replacements *Replace, SourceManager &SM, SourceLocation start) { size_t begin = 0; while ((begin = s.find("cuda", begin)) != StringRef::npos) { const size_t end = s.find_first_of(" ", begin + 4); StringRef name = s.slice(begin, end); - StringRef repName = map.cuda2hipRename[name]; + StringRef repName = map.cuda2hipRename[name].hipName; if (!repName.empty()) { SourceLocation sl = start.getLocWithOffset(begin + 1); Replacement Rep(SM, sl, name.size(), repName); @@ -283,7 +311,7 @@ struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { if (_sm->isWrittenInMainFile(hash_loc)) { if (is_angled) { if (N.cuda2hipRename.count(file_name)) { - StringRef repName = N.cuda2hipRename[file_name]; + StringRef repName = N.cuda2hipRename[file_name].hipName; DEBUG(dbgs() << "Include file found: " << file_name << "\n" << "SourceLocation:" << filename_range.getBegin().printToString(*_sm) << "\n" @@ -309,7 +337,7 @@ struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { if (T.isAnyIdentifier()) { StringRef name = T.getIdentifierInfo()->getName(); if (N.cuda2hipRename.count(name)) { - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; SourceLocation sl = T.getLocation(); DEBUG(dbgs() << "Identifier " << name << " found in definition of macro " @@ -353,7 +381,7 @@ struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { if (tok.isAnyIdentifier()) { StringRef name = tok.getIdentifierInfo()->getName(); if (N.cuda2hipRename.count(name)) { - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; DEBUG(dbgs() << "Identifier " << name << " found as an actual argument in expansion of macro " << macroName << "\n" @@ -383,7 +411,7 @@ private: Preprocessor *_pp; Replacements *Replace; - struct hipName N; + struct cuda2hipMap N; }; class Cuda2HipCallback : public MatchFinder::MatchCallback { @@ -435,7 +463,7 @@ public: const FunctionDecl *funcDcl = call->getDirectCallee(); StringRef name = funcDcl->getDeclName().getAsString(); if (N.cuda2hipRename.count(name)) { - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; SourceLocation sl = call->getLocStart(); Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? SM->getImmediateSpellingLoc(sl) @@ -533,7 +561,7 @@ public: memberName = memberName.slice(pos, memberName.size()); SmallString<128> tmpData; name = Twine(name + "." + memberName).toStringRef(tmpData); - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; SourceLocation sl = threadIdx->getLocStart(); Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); @@ -544,7 +572,7 @@ public: if (const DeclRefExpr *cudaEnumConstantRef = Result.Nodes.getNodeAs("cudaEnumConstantRef")) { StringRef name = cudaEnumConstantRef->getDecl()->getNameAsString(); - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; SourceLocation sl = cudaEnumConstantRef->getLocStart(); Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); @@ -554,7 +582,7 @@ public: Result.Nodes.getNodeAs("cudaEnumConstantDecl")) { StringRef name = cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; SourceLocation sl = cudaEnumConstantDecl->getLocStart(); Replacement Rep(*SM, sl, name.size(), repName); Replace->insert(Rep); @@ -566,7 +594,7 @@ public: ->getAsStructureType() ->getDecl() ->getNameAsString(); - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; TypeLoc TL = cudaStructVar->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); Replacement Rep(*SM, sl, name.size(), repName); @@ -578,7 +606,7 @@ public: const Type *t = cudaStructVarPtr->getType().getTypePtrOrNull(); if (t) { StringRef name = t->getPointeeCXXRecordDecl()->getName(); - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; TypeLoc TL = cudaStructVarPtr->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); Replacement Rep(*SM, sl, name.size(), repName); @@ -594,7 +622,7 @@ public: if (t->isStructureOrClassType()) { name = t->getAsCXXRecordDecl()->getName(); } - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; TypeLoc TL = cudaParamDecl->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); Replacement Rep(*SM, sl, name.size(), repName); @@ -610,7 +638,7 @@ public: StringRef name = t->isStructureOrClassType() ? t->getAsCXXRecordDecl()->getName() : StringRef(QT.getAsString()); - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; TypeLoc TL = cudaParamDeclPtr->getTypeSourceInfo()->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); Replacement Rep(*SM, sl, name.size(), repName); @@ -633,7 +661,7 @@ public: QualType QT = typeInfo->getType().getUnqualifiedType(); const Type *type = QT.getTypePtr(); StringRef name = type->getAsCXXRecordDecl()->getName(); - StringRef repName = N.cuda2hipRename[name]; + StringRef repName = N.cuda2hipRename[name].hipName; TypeLoc TL = typeInfo->getTypeLoc(); SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); Replacement Rep(*SM, sl, name.size(), repName); @@ -644,7 +672,7 @@ public: private: Replacements *Replace; ast_matchers::MatchFinder *owner; - struct hipName N; + struct cuda2hipMap N; }; } // end anonymous namespace @@ -661,10 +689,18 @@ static cl::opt OutputFilename("o", cl::desc("Output filename"), static cl::opt Inplace("inplace", cl::desc("Modify input file inplace, replacing input with hipified " - "output, save backup in .prehip file. " - "If .prehip file exists, use that as input to hip."), + "output, save backup in .prehip file. "), cl::value_desc("inplace"), cl::cat(ToolTemplateCategory)); +static cl::opt + NoOutput("no-output", + cl::desc("don't write any translated output to stdout"), + cl::value_desc("no-output"), cl::cat(ToolTemplateCategory)); +static cl::opt + PrintStats("print-stats", + cl::desc("print the command-line, like a header"), + cl::value_desc("print-stats"), cl::cat(ToolTemplateCategory)); + int main(int argc, const char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(); @@ -693,6 +729,7 @@ int main(int argc, const char **argv) { dst += ".cu"; } + // copy source file since tooling makes changes "inplace" std::ifstream source(fileSources[0], std::ios::binary); std::ofstream dest(Inplace ? dst + ".prehip" : dst, std::ios::binary); dest << source.rdbuf(); From 7b5a3413cb3a01d0f6c9a613dc8387309a5a8d4b Mon Sep 17 00:00:00 2001 From: dfukalov Date: Fri, 25 Mar 2016 18:28:37 +0300 Subject: [PATCH 36/82] implemented -print-stats option, minor cleanup & optimizations --- src/Cuda2Hip.cpp | 364 ++++++++++++++++++++++++++++++----------------- test/axpy.cu | 2 +- 2 files changed, 234 insertions(+), 132 deletions(-) diff --git a/src/Cuda2Hip.cpp b/src/Cuda2Hip.cpp index a78a35a3ab..65c051ec04 100644 --- a/src/Cuda2Hip.cpp +++ b/src/Cuda2Hip.cpp @@ -54,8 +54,6 @@ using namespace llvm; #define DEBUG_TYPE "cuda2hip" -namespace { - enum ConvTypes { CONV_DEV = 0, CONV_MEM, @@ -69,9 +67,17 @@ enum ConvTypes { CONV_DEF, CONV_TEX, CONV_OTHER, - CONV_INC, + CONV_INCLUDE, + CONV_LITERAL, CONV_LAST -} ; +}; + +const char *counterNames[ConvTypes::CONV_LAST] = { + "dev", "mem", "kern", "coord_func", "math_func", + "special_func", "stream", "event", "err", "def", + "tex", "other", "include", "literal"}; + +namespace { struct cuda2hipMap { cuda2hipMap() { @@ -79,8 +85,8 @@ struct cuda2hipMap { cuda2hipRename["__CUDACC__"] = {"__HIPCC__", CONV_DEF}; // includes - cuda2hipRename["cuda_runtime.h"] = {"hip_runtime.h", CONV_INC}; - cuda2hipRename["cuda_runtime_api.h"] = {"hip_runtime_api.h", CONV_INC}; + cuda2hipRename["cuda_runtime.h"] = {"hip_runtime.h", CONV_INCLUDE}; + cuda2hipRename["cuda_runtime_api.h"] = {"hip_runtime_api.h", CONV_INCLUDE}; // Error codes and return types: cuda2hipRename["cudaError_t"] = {"hipError_t", CONV_ERR}; @@ -88,14 +94,19 @@ struct cuda2hipMap { cuda2hipRename["cudaSuccess"] = {"hipSuccess", CONV_ERR}; cuda2hipRename["cudaErrorUnknown"] = {"hipErrorUnknown", CONV_ERR}; - cuda2hipRename["cudaErrorMemoryAllocation"] = {"hipErrorMemoryAllocation", CONV_ERR}; + cuda2hipRename["cudaErrorMemoryAllocation"] = {"hipErrorMemoryAllocation", + CONV_ERR}; cuda2hipRename["cudaErrorMemoryFree"] = {"hipErrorMemoryFree", CONV_ERR}; - cuda2hipRename["cudaErrorUnknownSymbol"] = {"hipErrorUnknownSymbol", CONV_ERR}; - cuda2hipRename["cudaErrorOutOfResources"] = {"hipErrorOutOfResources", CONV_ERR}; - cuda2hipRename["cudaErrorInvalidValue"] = {"hipErrorInvalidValue", CONV_ERR}; - cuda2hipRename["cudaErrorInvalidResourceHandle"] = - {"hipErrorInvalidResourceHandle", CONV_ERR}; - cuda2hipRename["cudaErrorInvalidDevice"] = {"hipErrorInvalidDevice", CONV_ERR}; + cuda2hipRename["cudaErrorUnknownSymbol"] = {"hipErrorUnknownSymbol", + CONV_ERR}; + cuda2hipRename["cudaErrorOutOfResources"] = {"hipErrorOutOfResources", + CONV_ERR}; + cuda2hipRename["cudaErrorInvalidValue"] = {"hipErrorInvalidValue", + CONV_ERR}; + cuda2hipRename["cudaErrorInvalidResourceHandle"] = { + "hipErrorInvalidResourceHandle", CONV_ERR}; + cuda2hipRename["cudaErrorInvalidDevice"] = {"hipErrorInvalidDevice", + CONV_ERR}; cuda2hipRename["cudaErrorNoDevice"] = {"hipErrorNoDevice", CONV_ERR}; cuda2hipRename["cudaErrorNotReady"] = {"hipErrorNotReady", CONV_ERR}; cuda2hipRename["cudaErrorUnknown"] = {"hipErrorUnknown", CONV_ERR}; @@ -109,9 +120,12 @@ struct cuda2hipMap { // Memcpy cuda2hipRename["cudaMemcpy"] = {"hipMemcpy", CONV_MEM}; cuda2hipRename["cudaMemcpyHostToHost"] = {"hipMemcpyHostToHost", CONV_MEM}; - cuda2hipRename["cudaMemcpyHostToDevice"] = {"hipMemcpyHostToDevice", CONV_MEM}; - cuda2hipRename["cudaMemcpyDeviceToHost"] = {"hipMemcpyDeviceToHost", CONV_MEM}; - cuda2hipRename["cudaMemcpyDeviceToDevice"] = {"hipMemcpyDeviceToDevice", CONV_MEM}; + cuda2hipRename["cudaMemcpyHostToDevice"] = {"hipMemcpyHostToDevice", + CONV_MEM}; + cuda2hipRename["cudaMemcpyDeviceToHost"] = {"hipMemcpyDeviceToHost", + CONV_MEM}; + cuda2hipRename["cudaMemcpyDeviceToDevice"] = {"hipMemcpyDeviceToDevice", + CONV_MEM}; cuda2hipRename["cudaMemcpyDefault"] = {"hipMemcpyDefault", CONV_MEM}; cuda2hipRename["cudaMemcpyToSymbol"] = {"hipMemcpyToSymbol", CONV_MEM}; cuda2hipRename["cudaMemset"] = {"hipMemset", CONV_MEM}; @@ -160,82 +174,102 @@ struct cuda2hipMap { // Events cuda2hipRename["cudaEvent_t"] = {"hipEvent_t", CONV_EVENT}; cuda2hipRename["cudaEventCreate"] = {"hipEventCreate", CONV_EVENT}; - cuda2hipRename["cudaEventCreateWithFlags"] = {"hipEventCreateWithFlags", CONV_EVENT}; + cuda2hipRename["cudaEventCreateWithFlags"] = {"hipEventCreateWithFlags", + CONV_EVENT}; cuda2hipRename["cudaEventDestroy"] = {"hipEventDestroy", CONV_EVENT}; cuda2hipRename["cudaEventRecord"] = {"hipEventRecord", CONV_EVENT}; - cuda2hipRename["cudaEventElapsedTime"] = {"hipEventElapsedTime", CONV_EVENT}; - cuda2hipRename["cudaEventSynchronize"] = {"hipEventSynchronize", CONV_EVENT}; + cuda2hipRename["cudaEventElapsedTime"] = {"hipEventElapsedTime", + CONV_EVENT}; + cuda2hipRename["cudaEventSynchronize"] = {"hipEventSynchronize", + CONV_EVENT}; // Streams cuda2hipRename["cudaStream_t"] = {"hipStream_t", CONV_STREAM}; cuda2hipRename["cudaStreamCreate"] = {"hipStreamCreate", CONV_STREAM}; - cuda2hipRename["cudaStreamCreateWithFlags"] = {"hipStreamCreateWithFlags", CONV_STREAM}; + cuda2hipRename["cudaStreamCreateWithFlags"] = {"hipStreamCreateWithFlags", + CONV_STREAM}; cuda2hipRename["cudaStreamDestroy"] = {"hipStreamDestroy", CONV_STREAM}; cuda2hipRename["cudaStreamWaitEvent"] = {"hipStreamWaitEven", CONV_STREAM}; - cuda2hipRename["cudaStreamSynchronize"] = {"hipStreamSynchronize", CONV_STREAM}; + cuda2hipRename["cudaStreamSynchronize"] = {"hipStreamSynchronize", + CONV_STREAM}; cuda2hipRename["cudaStreamDefault"] = {"hipStreamDefault", CONV_STREAM}; - cuda2hipRename["cudaStreamNonBlocking"] = {"hipStreamNonBlocking", CONV_STREAM}; + cuda2hipRename["cudaStreamNonBlocking"] = {"hipStreamNonBlocking", + CONV_STREAM}; // Other synchronization - cuda2hipRename["cudaDeviceSynchronize"] = {"hipDeviceSynchronize", CONV_DEV}; - cuda2hipRename["cudaThreadSynchronize"] = - {"hipDeviceSynchronize", CONV_DEV}; // translate deprecated cudaThreadSynchronize + cuda2hipRename["cudaDeviceSynchronize"] = {"hipDeviceSynchronize", + CONV_DEV}; + cuda2hipRename["cudaThreadSynchronize"] = { + "hipDeviceSynchronize", + CONV_DEV}; // translate deprecated cudaThreadSynchronize cuda2hipRename["cudaDeviceReset"] = {"hipDeviceReset", CONV_DEV}; - cuda2hipRename["cudaThreadExit"] = - {"hipDeviceReset", CONV_DEV}; // translate deprecated cudaThreadExit + cuda2hipRename["cudaThreadExit"] = { + "hipDeviceReset", CONV_DEV}; // translate deprecated cudaThreadExit cuda2hipRename["cudaSetDevice"] = {"hipSetDevice", CONV_DEV}; cuda2hipRename["cudaGetDevice"] = {"hipGetDevice", CONV_DEV}; // Attribute cuda2hipRename["bcudaDeviceAttr"] = {"hipDeviceAttribute_t", CONV_DEV}; - cuda2hipRename["bcudaDeviceGetAttribute"] = {"hipDeviceGetAttribute", CONV_DEV}; - + cuda2hipRename["bcudaDeviceGetAttribute"] = {"hipDeviceGetAttribute", + CONV_DEV}; + // Device cuda2hipRename["cudaDeviceProp"] = {"hipDeviceProp_t", CONV_DEV}; - cuda2hipRename["cudaGetDeviceProperties"] = {"hipDeviceGetProperties", CONV_DEV}; + cuda2hipRename["cudaGetDeviceProperties"] = {"hipDeviceGetProperties", + CONV_DEV}; // Cache config - cuda2hipRename["cudaDeviceSetCacheConfig"] = {"hipDeviceSetCacheConfig", CONV_DEV}; - cuda2hipRename["cudaThreadSetCacheConfig"] = - {"hipDeviceSetCacheConfig", CONV_DEV}; // translate deprecated - cuda2hipRename["cudaDeviceGetCacheConfig"] = {"hipDeviceGetCacheConfig", CONV_DEV}; - cuda2hipRename["cudaThreadGetCacheConfig"] = - {"hipDeviceGetCacheConfig", CONV_DEV}; // translate deprecated + cuda2hipRename["cudaDeviceSetCacheConfig"] = {"hipDeviceSetCacheConfig", + CONV_DEV}; + cuda2hipRename["cudaThreadSetCacheConfig"] = { + "hipDeviceSetCacheConfig", CONV_DEV}; // translate deprecated + cuda2hipRename["cudaDeviceGetCacheConfig"] = {"hipDeviceGetCacheConfig", + CONV_DEV}; + cuda2hipRename["cudaThreadGetCacheConfig"] = { + "hipDeviceGetCacheConfig", CONV_DEV}; // translate deprecated cuda2hipRename["cudaFuncCache"] = {"hipFuncCache", CONV_DEV}; - cuda2hipRename["cudaFuncCachePreferNone"] = {"hipFuncCachePreferNone", CONV_DEV}; - cuda2hipRename["cudaFuncCachePreferShared"] = {"hipFuncCachePreferShared", CONV_DEV}; - cuda2hipRename["cudaFuncCachePreferL1"] = {"hipFuncCachePreferL1", CONV_DEV}; - cuda2hipRename["cudaFuncCachePreferEqual"] = {"hipFuncCachePreferEqual", CONV_DEV}; + cuda2hipRename["cudaFuncCachePreferNone"] = {"hipFuncCachePreferNone", + CONV_DEV}; + cuda2hipRename["cudaFuncCachePreferShared"] = {"hipFuncCachePreferShared", + CONV_DEV}; + cuda2hipRename["cudaFuncCachePreferL1"] = {"hipFuncCachePreferL1", + CONV_DEV}; + cuda2hipRename["cudaFuncCachePreferEqual"] = {"hipFuncCachePreferEqual", + CONV_DEV}; // function - cuda2hipRename["cudaFuncSetCacheConfig"] = {"hipFuncSetCacheConfig", CONV_DEV}; + cuda2hipRename["cudaFuncSetCacheConfig"] = {"hipFuncSetCacheConfig", + CONV_DEV}; cuda2hipRename["cudaDriverGetVersion"] = {"hipDriverGetVersion", CONV_DEV}; -// cuda2hipRename["cudaRuntimeGetVersion"] = {"hipRuntimeGetVersion", CONV_DEV}; + // cuda2hipRename["cudaRuntimeGetVersion"] = {"hipRuntimeGetVersion", + // CONV_DEV}; // Peer2Peer - cuda2hipRename["cudaDeviceCanAccessPeer"] = {"hipDeviceCanAccessPeer", CONV_DEV}; - cuda2hipRename["cudaDeviceDisablePeerAccess"] = - {"hipDeviceDisablePeerAccess", CONV_DEV}; - cuda2hipRename["cudaDeviceEnablePeerAccess"] = {"hipDeviceEnablePeerAccess", CONV_DEV}; + cuda2hipRename["cudaDeviceCanAccessPeer"] = {"hipDeviceCanAccessPeer", + CONV_DEV}; + cuda2hipRename["cudaDeviceDisablePeerAccess"] = { + "hipDeviceDisablePeerAccess", CONV_DEV}; + cuda2hipRename["cudaDeviceEnablePeerAccess"] = {"hipDeviceEnablePeerAccess", + CONV_DEV}; cuda2hipRename["cudaMemcpyPeerAsync"] = {"hipMemcpyPeerAsync", CONV_MEM}; cuda2hipRename["cudaMemcpyPeer"] = {"hipMemcpyPeer", CONV_MEM}; // Shared mem: - cuda2hipRename["cudaDeviceSetSharedMemConfig"] = - {"hipDeviceSetSharedMemConfig", CONV_DEV}; - cuda2hipRename["cudaThreadSetSharedMemConfig"] = - {"hipDeviceSetSharedMemConfig", CONV_DEV}; // translate deprecated - cuda2hipRename["cudaDeviceGetSharedMemConfig"] = - {"hipDeviceGetSharedMemConfig", CONV_DEV}; - cuda2hipRename["cudaThreadGetSharedMemConfig"] = - {"hipDeviceGetSharedMemConfig", CONV_DEV}; // translate deprecated + cuda2hipRename["cudaDeviceSetSharedMemConfig"] = { + "hipDeviceSetSharedMemConfig", CONV_DEV}; + cuda2hipRename["cudaThreadSetSharedMemConfig"] = { + "hipDeviceSetSharedMemConfig", CONV_DEV}; // translate deprecated + cuda2hipRename["cudaDeviceGetSharedMemConfig"] = { + "hipDeviceGetSharedMemConfig", CONV_DEV}; + cuda2hipRename["cudaThreadGetSharedMemConfig"] = { + "hipDeviceGetSharedMemConfig", CONV_DEV}; // translate deprecated cuda2hipRename["cudaSharedMemConfig"] = {"hipSharedMemConfig", CONV_DEV}; - cuda2hipRename["cudaSharedMemBankSizeDefault"] = - {"hipSharedMemBankSizeDefault", CONV_DEV}; - cuda2hipRename["cudaSharedMemBankSizeFourByte"] = - {"hipSharedMemBankSizeFourByte", CONV_DEV}; - cuda2hipRename["cudaSharedMemBankSizeEightByte"] = - {"hipSharedMemBankSizeEightByte", CONV_DEV}; + cuda2hipRename["cudaSharedMemBankSizeDefault"] = { + "hipSharedMemBankSizeDefault", CONV_DEV}; + cuda2hipRename["cudaSharedMemBankSizeFourByte"] = { + "hipSharedMemBankSizeFourByte", CONV_DEV}; + cuda2hipRename["cudaSharedMemBankSizeEightByte"] = { + "hipSharedMemBankSizeEightByte", CONV_DEV}; cuda2hipRename["cudaGetDeviceCount"] = {"hipGetDeviceCount", CONV_DEV}; @@ -245,21 +279,24 @@ struct cuda2hipMap { cuda2hipRename["cudaProfilerStart"] = {"hipProfilerStart", CONV_OTHER}; cuda2hipRename["cudaProfilerStop"] = {"hipProfilerStop", CONV_OTHER}; - cuda2hipRename["cudaChannelFormatDesc"] = {"hipChannelFormatDesc", CONV_TEX}; + cuda2hipRename["cudaChannelFormatDesc"] = {"hipChannelFormatDesc", + CONV_TEX}; cuda2hipRename["cudaFilterModePoint"] = {"hipFilterModePoint", CONV_TEX}; - cuda2hipRename["cudaReadModeElementType"] = {"hipReadModeElementType", CONV_TEX}; + cuda2hipRename["cudaReadModeElementType"] = {"hipReadModeElementType", + CONV_TEX}; - cuda2hipRename["cudaCreateChannelDesc"] = {"hipCreateChannelDesc", CONV_TEX}; + cuda2hipRename["cudaCreateChannelDesc"] = {"hipCreateChannelDesc", + CONV_TEX}; cuda2hipRename["cudaBindTexture"] = {"hipBindTexture", CONV_TEX}; cuda2hipRename["cudaUnbindTexture"] = {"hipUnbindTexture", CONV_TEX}; } - + struct HipNames { StringRef hipName; ConvTypes countType; }; - - SmallDenseMap cuda2hipRename; + + SmallDenseMap cuda2hipRename; }; StringRef unquoteStr(StringRef s) { @@ -268,14 +305,18 @@ StringRef unquoteStr(StringRef s) { return s; } -static void processString(StringRef s, struct cuda2hipMap &map, Replacements *Replace, - SourceManager &SM, SourceLocation start) { +static void processString(StringRef s, const cuda2hipMap &map, + Replacements *Replace, SourceManager &SM, + SourceLocation start, + int64_t countReps[ConvTypes::CONV_LAST]) { size_t begin = 0; while ((begin = s.find("cuda", begin)) != StringRef::npos) { const size_t end = s.find_first_of(" ", begin + 4); StringRef name = s.slice(begin, end); - StringRef repName = map.cuda2hipRename[name].hipName; - if (!repName.empty()) { + const auto found = map.cuda2hipRename.find(name); + if (found != map.cuda2hipRename.end()) { + countReps[CONV_LITERAL]++; + StringRef repName = found->second.hipName; SourceLocation sl = start.getLocWithOffset(begin + 1); Replacement Rep(SM, sl, name.size(), repName); Replace->insert(Rep); @@ -310,8 +351,10 @@ struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { const clang::Module *imported) override { if (_sm->isWrittenInMainFile(hash_loc)) { if (is_angled) { - if (N.cuda2hipRename.count(file_name)) { - StringRef repName = N.cuda2hipRename[file_name].hipName; + const auto found = N.cuda2hipRename.find(file_name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; DEBUG(dbgs() << "Include file found: " << file_name << "\n" << "SourceLocation:" << filename_range.getBegin().printToString(*_sm) << "\n" @@ -336,8 +379,10 @@ struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { for (auto T : MD->getMacroInfo()->tokens()) { if (T.isAnyIdentifier()) { StringRef name = T.getIdentifierInfo()->getName(); - if (N.cuda2hipRename.count(name)) { - StringRef repName = N.cuda2hipRename[name].hipName; + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; SourceLocation sl = T.getLocation(); DEBUG(dbgs() << "Identifier " << name << " found in definition of macro " @@ -380,12 +425,15 @@ struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { for (auto tok : toks) { if (tok.isAnyIdentifier()) { StringRef name = tok.getIdentifierInfo()->getName(); - if (N.cuda2hipRename.count(name)) { - StringRef repName = N.cuda2hipRename[name].hipName; - DEBUG(dbgs() << "Identifier " << name - << " found as an actual argument in expansion of macro " - << macroName << "\n" - << "will be replaced with: " << repName << "\n"); + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; + DEBUG(dbgs() + << "Identifier " << name + << " found as an actual argument in expansion of macro " + << macroName << "\n" + << "will be replaced with: " << repName << "\n"); SourceLocation sl = tok.getLocation(); Replacement Rep(*_sm, sl, name.size(), repName); Replace->insert(Rep); @@ -393,7 +441,8 @@ struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { } if (tok.is(tok::string_literal)) { StringRef s(tok.getLiteralData(), tok.getLength()); - processString(unquoteStr(s), N, Replace, *_sm, tok.getLocation()); + processString(unquoteStr(s), N, Replace, *_sm, tok.getLocation(), + countReps); } } } @@ -406,6 +455,8 @@ struct HipifyPPCallbacks : public PPCallbacks, public SourceFileCallbacks { void setSourceManager(SourceManager *sm) { _sm = sm; } void setPreprocessor(Preprocessor *pp) { _pp = pp; } + int64_t countReps[ConvTypes::CONV_LAST] = {0}; + private: SourceManager *_sm; Preprocessor *_pp; @@ -462,8 +513,10 @@ public: Result.Nodes.getNodeAs("cudaCall")) { const FunctionDecl *funcDcl = call->getDirectCallee(); StringRef name = funcDcl->getDeclName().getAsString(); - if (N.cuda2hipRename.count(name)) { - StringRef repName = N.cuda2hipRename[name].hipName; + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; SourceLocation sl = call->getLocStart(); Replacement Rep(*SM, SM->isMacroArgExpansion(sl) ? SM->getImmediateSpellingLoc(sl) @@ -498,7 +551,8 @@ public: OS << "hipLaunchKernel(HIP_KERNEL_NAME(" << calleeName << "),"; const CallExpr *config = launchKernel->getConfig(); - DEBUG(dbgs() << "Kernel config arguments:" << "\n"); + DEBUG(dbgs() << "Kernel config arguments:" + << "\n"); for (unsigned argno = 0; argno < config->getNumArgs(); argno++) { const Expr *arg = config->getArg(argno); if (!isa(arg)) { @@ -512,7 +566,8 @@ public: StringRef outs(SM->getCharacterData(sl), SM->getCharacterData(stop) - SM->getCharacterData(sl)); DEBUG(dbgs() << "args[ " << argno << "]" << outs << " <" - << pvd->getType().getAsString() << ">" << "\n"); + << pvd->getType().getAsString() << ">" + << "\n"); if (pvd->getType().getAsString().compare("dim3") == 0) OS << " dim3(" << outs << "),"; else @@ -540,6 +595,7 @@ public: SM->getCharacterData(launchKernel->getLocStart()); Replacement Rep(*SM, launchKernel->getLocStart(), length, OS.str()); Replace->insert(Rep); + countReps[ConvTypes::CONV_KERN]++; } if (const FunctionTemplateDecl *templateDecl = @@ -561,10 +617,14 @@ public: memberName = memberName.slice(pos, memberName.size()); SmallString<128> tmpData; name = Twine(name + "." + memberName).toStringRef(tmpData); - StringRef repName = N.cuda2hipRename[name].hipName; - SourceLocation sl = threadIdx->getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; + SourceLocation sl = threadIdx->getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } } } } @@ -572,20 +632,28 @@ public: if (const DeclRefExpr *cudaEnumConstantRef = Result.Nodes.getNodeAs("cudaEnumConstantRef")) { StringRef name = cudaEnumConstantRef->getDecl()->getNameAsString(); - StringRef repName = N.cuda2hipRename[name].hipName; - SourceLocation sl = cudaEnumConstantRef->getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; + SourceLocation sl = cudaEnumConstantRef->getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } } if (const VarDecl *cudaEnumConstantDecl = Result.Nodes.getNodeAs("cudaEnumConstantDecl")) { StringRef name = cudaEnumConstantDecl->getType()->getAsTagDecl()->getNameAsString(); - StringRef repName = N.cuda2hipRename[name].hipName; - SourceLocation sl = cudaEnumConstantDecl->getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; + SourceLocation sl = cudaEnumConstantDecl->getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } } if (const VarDecl *cudaStructVar = @@ -594,11 +662,15 @@ public: ->getAsStructureType() ->getDecl() ->getNameAsString(); - StringRef repName = N.cuda2hipRename[name].hipName; - TypeLoc TL = cudaStructVar->getTypeSourceInfo()->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; + TypeLoc TL = cudaStructVar->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } } if (const VarDecl *cudaStructVarPtr = @@ -606,11 +678,15 @@ public: const Type *t = cudaStructVarPtr->getType().getTypePtrOrNull(); if (t) { StringRef name = t->getPointeeCXXRecordDecl()->getName(); - StringRef repName = N.cuda2hipRename[name].hipName; - TypeLoc TL = cudaStructVarPtr->getTypeSourceInfo()->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; + TypeLoc TL = cudaStructVarPtr->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } } } @@ -622,11 +698,15 @@ public: if (t->isStructureOrClassType()) { name = t->getAsCXXRecordDecl()->getName(); } - StringRef repName = N.cuda2hipRename[name].hipName; - TypeLoc TL = cudaParamDecl->getTypeSourceInfo()->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; + TypeLoc TL = cudaParamDecl->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } } if (const ParmVarDecl *cudaParamDeclPtr = @@ -638,11 +718,15 @@ public: StringRef name = t->isStructureOrClassType() ? t->getAsCXXRecordDecl()->getName() : StringRef(QT.getAsString()); - StringRef repName = N.cuda2hipRename[name].hipName; - TypeLoc TL = cudaParamDeclPtr->getTypeSourceInfo()->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; + TypeLoc TL = cudaParamDeclPtr->getTypeSourceInfo()->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } } } @@ -650,7 +734,8 @@ public: Result.Nodes.getNodeAs("stringLiteral")) { if (stringLiteral->getCharByteWidth() == 1) { StringRef s = stringLiteral->getString(); - processString(s, N, Replace, *SM, stringLiteral->getLocStart()); + processString(s, N, Replace, *SM, stringLiteral->getLocStart(), + countReps); } } @@ -661,14 +746,20 @@ public: QualType QT = typeInfo->getType().getUnqualifiedType(); const Type *type = QT.getTypePtr(); StringRef name = type->getAsCXXRecordDecl()->getName(); - StringRef repName = N.cuda2hipRename[name].hipName; - TypeLoc TL = typeInfo->getTypeLoc(); - SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); - Replacement Rep(*SM, sl, name.size(), repName); - Replace->insert(Rep); + const auto found = N.cuda2hipRename.find(name); + if (found != N.cuda2hipRename.end()) { + countReps[found->second.countType]++; + StringRef repName = found->second.hipName; + TypeLoc TL = typeInfo->getTypeLoc(); + SourceLocation sl = TL.getUnqualifiedLoc().getLocStart(); + Replacement Rep(*SM, sl, name.size(), repName); + Replace->insert(Rep); + } } } + int64_t countReps[ConvTypes::CONV_LAST] = {0}; + private: Replacements *Replace; ast_matchers::MatchFinder *owner; @@ -694,13 +785,12 @@ static cl::opt static cl::opt NoOutput("no-output", - cl::desc("don't write any translated output to stdout"), - cl::value_desc("no-output"), cl::cat(ToolTemplateCategory)); + cl::desc("don't write any translated output to stdout"), + cl::value_desc("no-output"), cl::cat(ToolTemplateCategory)); static cl::opt - PrintStats("print-stats", - cl::desc("print the command-line, like a header"), - cl::value_desc("print-stats"), cl::cat(ToolTemplateCategory)); - + PrintStats("print-stats", cl::desc("print the command-line, like a header"), + cl::value_desc("print-stats"), cl::cat(ToolTemplateCategory)); + int main(int argc, const char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(); @@ -788,7 +878,7 @@ int main(int argc, const char **argv) { std::vector compilationStages; compilationStages.push_back("--cuda-host-only"); - compilationStages.push_back("--cuda-device-only"); + //compilationStages.push_back("--cuda-device-only"); for (auto Stage : compilationStages) { Tool.appendArgumentsAdjuster( @@ -797,7 +887,7 @@ int main(int argc, const char **argv) { #if defined(HIPIFY_CLANG_RES) Tool.appendArgumentsAdjuster( getInsertArgumentAdjuster("-resource-dir=" HIPIFY_CLANG_RES)); -#endif // defined(HIPIFY_CLANG_HEADERS) +#endif Tool.appendArgumentsAdjuster(getClangSyntaxOnlyAdjuster()); Result = Tool.run(action.get()); @@ -831,5 +921,17 @@ int main(int argc, const char **argv) { rename(dst.c_str(), dst.substr(0, pos).c_str()); } } + if (PrintStats) { + int64_t sum = 0; + for (int i = 0; i < ConvTypes::CONV_LAST; i++) { + sum += Callback.countReps[i] + PPCallbacks.countReps[i]; + } + llvm::outs() << "info: converted " << sum << " CUDA->HIP refs ( "; + for (int i = 0; i < ConvTypes::CONV_LAST; i++) { + llvm::outs() << counterNames[i] << ':' + << Callback.countReps[i] + PPCallbacks.countReps[i] << ' '; + } + llvm::outs() << ") in \'" << fileSources[0] << "\'\n"; + } return Result; } diff --git a/test/axpy.cu b/test/axpy.cu index 9e83ccb7e6..92f61267a4 100644 --- a/test/axpy.cu +++ b/test/axpy.cu @@ -23,7 +23,7 @@ int main(int argc, char* argv[]) { cudaMemcpy(device_x, host_x, kDataLen * sizeof(float), cudaMemcpyHostToDevice); // Launch the kernel. - // CHECK: hipLaunchKernel(HIP_KERNEL_NAME(axpy), dim3(1), dim3(kDataLen), 0, 0, a, device_x, device_y); + // CHECK: hipLaunchKernel(HIP_KERNEL_NAME(axpy), dim3(1), dim3(kDataLen), 0, 0, a, device_x, device_y); axpy<<<1, kDataLen>>>(a, device_x, device_y); // Copy output data to host. From 28d29cac822a9abfd31b4475be03360d0a3d8a8c Mon Sep 17 00:00:00 2001 From: dfukalov Date: Sat, 26 Mar 2016 16:01:49 +0300 Subject: [PATCH 37/82] removed FileCheck dependency & significantly improved test coverage --- README.md | 5 ++--- test/CMakeLists.txt | 2 +- test/axpy.cu | 11 ++++++++--- test/lit.cfg | 7 ------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 743a1a63b2..0b37244def 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git ll echo "add_subdirectory(hipify)" >> llvm/tools/clang/tools/extra/CMakeLists.txt mkdir llvm_build && cd llvm_build -cmake -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm +cmake -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" ../llvm make ``` @@ -25,7 +25,7 @@ git clone http://llvm.org/git/llvm.git llvm git clone http://llvm.org/git/clang.git llvm/tools/clang mkdir llvm_build && cd llvm_build -cmake -DCMAKE_INSTALL_PREFIX="LLVM_INSTALL_PATH" -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ../llvm +cmake -DCMAKE_INSTALL_PREFIX="LLVM_INSTALL_PATH" -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" ../llvm make && make install git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git path_to_hipify_src @@ -37,7 +37,6 @@ make # How to run tests (for *standalone* tool only) - install Python and add python-setuptools - install lit python script -- make sure that FileCheck util is installed to **LLVM_INSTALL_PATH/bin/FileCheck** - run tests from path_to_hipify_src/build ``` sudo apt-get install python python-setuptools diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5a0250381d..ba472ad2ee 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,7 +16,7 @@ configure_file( add_lit_testsuite(check-hipify "Running HIPify regression tests" ${CMAKE_CURRENT_SOURCE_DIR} PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg - DEPENDS hipify FileCheck lit + DEPENDS hipify lit ) add_custom_target(check) diff --git a/test/axpy.cu b/test/axpy.cu index 92f61267a4..8472e60209 100644 --- a/test/axpy.cu +++ b/test/axpy.cu @@ -1,10 +1,9 @@ // RUN: hipify "%s" -o=%t -- -// RUN: FileCheck %s -input-file=%t --match-full-lines #include __global__ void axpy(float a, float* x, float* y) { - // CHECK: y[hipThreadIdx_x] = a * x[hipThreadIdx_x]; + // RUN: sh -c "test `grep -c -F 'y[hipThreadIdx_x] = a * x[hipThreadIdx_x];' %t` -eq 2" y[threadIdx.x] = a * x[threadIdx.x]; } @@ -18,16 +17,21 @@ int main(int argc, char* argv[]) { // Copy input data to device. float* device_x; float* device_y; + // RUN: sh -c "test `grep -c -F 'hipMalloc(&device_x, kDataLen * sizeof(float));' %t` -eq 2" cudaMalloc(&device_x, kDataLen * sizeof(float)); + // RUN: sh -c "test `grep -c -F 'hipMalloc(&device_y, kDataLen * sizeof(float));' %t` -eq 2" cudaMalloc(&device_y, kDataLen * sizeof(float)); + // RUN: sh -c "test `grep -c -F 'hipMemcpy(device_x, host_x, kDataLen * sizeof(float), hipMemcpyHostToDevice);' %t` -eq 2" cudaMemcpy(device_x, host_x, kDataLen * sizeof(float), cudaMemcpyHostToDevice); // Launch the kernel. - // CHECK: hipLaunchKernel(HIP_KERNEL_NAME(axpy), dim3(1), dim3(kDataLen), 0, 0, a, device_x, device_y); + // RUN: sh -c "test `grep -c -F 'hipLaunchKernel(HIP_KERNEL_NAME(axpy), dim3(1), dim3(kDataLen), 0, 0, a, device_x, device_y);' %t` -eq 2" axpy<<<1, kDataLen>>>(a, device_x, device_y); // Copy output data to host. + // RUN: sh -c "test `grep -c -F 'hipDeviceSynchronize();' %t` -eq 2" cudaDeviceSynchronize(); + // RUN: sh -c "test `grep -c -F 'hipMemcpy(host_y, device_y, kDataLen * sizeof(float), hipMemcpyDeviceToHost);' %t` -eq 2" cudaMemcpy(host_y, device_y, kDataLen * sizeof(float), cudaMemcpyDeviceToHost); // Print the results. @@ -35,6 +39,7 @@ int main(int argc, char* argv[]) { std::cout << "y[" << i << "] = " << host_y[i] << "\n"; } + // RUN: sh -c "test `grep -c -F 'hipDeviceReset();' %t` -eq 2" cudaDeviceReset(); return 0; } diff --git a/test/lit.cfg b/test/lit.cfg index d9606b48fc..5c070ae053 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -44,12 +44,5 @@ if obj_root is not None: path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) config.environment['PATH'] = path -tool_name = "FileCheck" -tool_path = lit.util.which(tool_name, llvm_tools_dir) -if not tool_path: - # Warn, but still provide a substitution. - lit_config.note('Did not find ' + tool_name + ' in ' + llvm_tools_dir) - tool_path = llvm_tools_dir + '/' + tool_name -config.substitutions.append((tool_name, tool_path)) config.substitutions.append(("hipify", obj_root+"/hipify")) From 53cca9a20aa46a66e5e019208bff8317a2c1b140 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Tue, 5 Apr 2016 00:10:21 +0300 Subject: [PATCH 38/82] initial cmake add --- CMakeLists.txt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b25a21394..b3daa69aa6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,9 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +set(HIPIFY_STANDLONE 1) +add_subdirectory(clang-hipify) + if(NOT DEFINED HCC_HOME) if(NOT DEFINED ENV{HCC_HOME}) set(HCC_HOME "/opt/hcc" CACHE PATH "Path to which HCC has been installed") @@ -55,14 +58,7 @@ set(CMAKE_CXX_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -stdlib=li set(CMAKE_C_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -stdlib=libc++ ") set(SOURCE_FILES src/device_util.cpp -src/hip_hcc.cpp -src/hip_device.cpp -src/hip_error.cpp -src/hip_event.cpp -src/hip_memory.cpp -src/hip_peer.cpp -src/hip_stream.cpp -src/staging_buffer.cpp) +) if(NOT DEFINED ENV{HIP_USE_SHARED_LIBRARY}) set(HIP_USE_SHARED_LIBRARY 0) From f9cf240f7a87c6da0c39be73f211ea4671d41f54 Mon Sep 17 00:00:00 2001 From: dfukalov Date: Wed, 6 Apr 2016 20:44:19 +0300 Subject: [PATCH 39/82] moved clang-hipify tests to common folder "tests", updated cmake files to use downloadable clang+llvm binary package --- CMakeLists.txt | 1 - clang-hipify/CMakeLists.txt | 76 +++++++++++-------- clang-hipify/test/CMakeLists.txt | 27 ------- .../test => tests/clang-hipify}/axpy.cu | 0 .../test => tests/clang-hipify}/lit.cfg | 2 +- .../clang-hipify}/lit.site.cfg.in | 0 6 files changed, 45 insertions(+), 61 deletions(-) delete mode 100644 clang-hipify/test/CMakeLists.txt rename {clang-hipify/test => tests/clang-hipify}/axpy.cu (100%) rename {clang-hipify/test => tests/clang-hipify}/lit.cfg (95%) rename {clang-hipify/test => tests/clang-hipify}/lit.site.cfg.in (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3daa69aa6..5346ea7c69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,6 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() -set(HIPIFY_STANDLONE 1) add_subdirectory(clang-hipify) if(NOT DEFINED HCC_HOME) diff --git a/clang-hipify/CMakeLists.txt b/clang-hipify/CMakeLists.txt index 18e8e7df4d..574677aa7e 100644 --- a/clang-hipify/CMakeLists.txt +++ b/clang-hipify/CMakeLists.txt @@ -1,32 +1,22 @@ -if(${HIPIFY_STANDLONE}) - cmake_minimum_required(VERSION 2.8.8) +cmake_minimum_required(VERSION 2.8.8) - project(hipify) +project(hipify-clang) - find_package(LLVM REQUIRED PATHS ${LLVM_DIR} NO_DEFAULT_PATH) +find_package(LLVM 3.8 REQUIRED PATHS ${LLVM_DIR} NO_DEFAULT_PATH) - list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR}) - include(AddLLVM) +list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR}) +include(AddLLVM) - message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") - message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") - - include_directories(${LLVM_INCLUDE_DIRS}) - link_directories(${LLVM_LIBRARY_DIRS}) - add_definitions(${LLVM_DEFINITIONS}) - add_llvm_executable(hipify src/Cuda2Hip.cpp ) - find_program(LIT_COMMAND lit) -else() - set(LLVM_LINK_COMPONENTS - Option - Support - ) - add_clang_executable(hipify src/Cuda2Hip.cpp) -endif() +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") +include_directories(${LLVM_INCLUDE_DIRS}) +link_directories(${LLVM_LIBRARY_DIRS}) +add_definitions(${LLVM_DEFINITIONS}) +add_llvm_executable(hipify-clang src/Cuda2Hip.cpp ) +find_program(LIT_COMMAND lit) # Link against LLVM and CLANG tools libraries -target_link_libraries(hipify +target_link_libraries(hipify-clang clangASTMatchers clangFrontend clangTooling @@ -49,14 +39,36 @@ target_link_libraries(hipify LLVMOption LLVMCore) -if(${HIPIFY_STANDLONE}) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fno-rtti -fvisibility-inlines-hidden") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\"") - add_subdirectory(test) -else() - install(TARGETS hipify - RUNTIME DESTINATION bin - COMPONENT clang-extras) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -fno-rtti -fvisibility-inlines-hidden") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\"") + +install(TARGETS hipify-clang + DESTINATION bin) + +# tests +set(Python_ADDITIONAL_VERSIONS 2.7) +include(FindPythonInterp) +if( NOT PYTHONINTERP_FOUND ) + message(FATAL_ERROR + "Unable to find Python interpreter, required for builds and testing\n\n" + "Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") endif() + +set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) + +configure_file( + ${CMAKE_SOURCE_DIR}/tests/clang-hipify/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/tests/clang-hipify/lit.site.cfg + @ONLY) + +add_lit_testsuite(test-hipify "Running HIPify regression tests" + ${CMAKE_SOURCE_DIR}/tests/clang-hipify + PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/tests/clang-hipify/lit.site.cfg + DEPENDS hipify-clang lit + ) + +add_custom_target(test-clang-hipify) +add_dependencies(test-clang-hipify test-hipify) +set_target_properties(test-clang-hipify PROPERTIES FOLDER "Tests") diff --git a/clang-hipify/test/CMakeLists.txt b/clang-hipify/test/CMakeLists.txt deleted file mode 100644 index ba472ad2ee..0000000000 --- a/clang-hipify/test/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -set(Python_ADDITIONAL_VERSIONS 2.7) -include(FindPythonInterp) -if( NOT PYTHONINTERP_FOUND ) - message(FATAL_ERROR - "Unable to find Python interpreter, required for builds and testing\n\n" - "Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") -endif() - -set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/.. ) - -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg - @ONLY) - -add_lit_testsuite(check-hipify "Running HIPify regression tests" - ${CMAKE_CURRENT_SOURCE_DIR} - PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg - DEPENDS hipify lit - ) - -add_custom_target(check) -add_dependencies(check check-hipify) -add_custom_target(test) -add_dependencies(test check-hipify) -set_target_properties(check PROPERTIES FOLDER "Tests") - diff --git a/clang-hipify/test/axpy.cu b/tests/clang-hipify/axpy.cu similarity index 100% rename from clang-hipify/test/axpy.cu rename to tests/clang-hipify/axpy.cu diff --git a/clang-hipify/test/lit.cfg b/tests/clang-hipify/lit.cfg similarity index 95% rename from clang-hipify/test/lit.cfg rename to tests/clang-hipify/lit.cfg index 5c070ae053..c57b8ec524 100644 --- a/clang-hipify/test/lit.cfg +++ b/tests/clang-hipify/lit.cfg @@ -44,5 +44,5 @@ if obj_root is not None: path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) config.environment['PATH'] = path -config.substitutions.append(("hipify", obj_root+"/hipify")) +config.substitutions.append(("hipify", obj_root+"/hipify-clang")) diff --git a/clang-hipify/test/lit.site.cfg.in b/tests/clang-hipify/lit.site.cfg.in similarity index 100% rename from clang-hipify/test/lit.site.cfg.in rename to tests/clang-hipify/lit.site.cfg.in From a456027e5a8054c5ae6385895fa54715d02877e1 Mon Sep 17 00:00:00 2001 From: Daniil Fukalov Date: Thu, 7 Apr 2016 00:36:27 +0300 Subject: [PATCH 40/82] added clang-hipify added option to cmake and description how to download and install clang-hipify prerequisites --- README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 810c378436..9d5cf663b0 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,11 @@ New projects can be developed directly in the portable HIP C++ language and can cd HIP-privatestaging mkdir build cd build -cmake -DHSA_PATH=/path/to/hsa -DHCC_HOME=/path/to/hcc -DCMAKE_INSTALL_PREFIX=/where/to/install/hip -DCMAKE_BUILD_TYPE=Release .. +cmake -DHSA_PATH=/path/to/hsa -DHCC_HOME=/path/to/hcc -DCMAKE_INSTALL_PREFIX=/where/to/install/hip -DLLVM_DIR=/path/to/clang-llvm-3.8 -DCMAKE_BUILD_TYPE=Release .. make make install ``` -Make sure HIP_PATH is pointed to `/where/to/install/hip` and PATH includes `$HIP_PATH/bin`. This requirement is optional, but required to run any HIP test infrastructure. +Make sure HIP_PATH is pointed to `/where/to/install/hip` and PATH includes `$HIP_PATH/bin`. This requirement is optional, but required to run any HIP test infrastructure. The path `/path/to/clang-llvm-3.8` should be specified for [clang-hipify](README.md#clang-hipify) utility build. ## More Info: - [HIP FAQ](docs/markdown/hip_faq.md) @@ -42,7 +42,23 @@ HIP code can be developed either on AMD HSA or Boltzmann platform using hcc comp * By default HIP looks for hcc in /opt/hcc (can be overridden by setting HCC_HOME environment variable) * By default HIP looks for HSA in /opt/hsa (can be overridden by setting HSA_PATH environment variable) * Ensure that ROCR runtime is installed and added to LD_LIBRARY_PATH - + +#####clang-hipify +To build and run clang based hipify utiliy a set of CUDA headers and clang+llvm 3.8 binary package are required: +- download and install CUDA minimal prerequisites: + 1. Download "deb(network)" variant of target installer from https://developer.nvidia.com/cuda-downloads. E.g. at the moment the link is http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb + 2. install clang prerequisites with the following commands: +``` +wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb +sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb +sudo apt-get update && sudo apt-get install cuda-minimal-build-7-5 cuda-curand-dev-7-5 +``` +- download and unpack clang+llvm 3.8 binary package: +``` +wget http://llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz +tar xvfJ clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C /path/to/clang-llvm-3.8 +``` + #### NVIDIA (nvcc) * Install CUDA SDK from manufacturer website * By default HIP looks for CUDA SDK in /usr/local/cuda (can be overriden by setting CUDA_PATH env variable) From d12aaee30e009ca9983ee59386b91cd0002bddd9 Mon Sep 17 00:00:00 2001 From: Daniil Fukalov Date: Thu, 7 Apr 2016 00:37:20 +0300 Subject: [PATCH 41/82] Delete README.md --- clang-hipify/README.md | 52 ------------------------------------------ 1 file changed, 52 deletions(-) delete mode 100644 clang-hipify/README.md diff --git a/clang-hipify/README.md b/clang-hipify/README.md deleted file mode 100644 index 0b37244def..0000000000 --- a/clang-hipify/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# HIPIFY -The CLANG-based HIPIFY tool - translates CUDA to [HIP](https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/blob/master/README.md) - -# How to Build tool *in llvm source tree* -- get LLVM, CLANG and clang-tools-extra sources -- put hipify folder into llvm/tools/clang/tools/extra, add it to llvm/tools/clang/tools/extra/CMakeLists.txt -- run cmake and build tool -``` -git clone http://llvm.org/git/llvm.git llvm -git clone http://llvm.org/git/clang.git llvm/tools/clang -git clone http://llvm.org/git/clang-tools-extra.git llvm/tools/clang/tools/extra -git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git llvm/tools/clang/tools/extra/hipify -echo "add_subdirectory(hipify)" >> llvm/tools/clang/tools/extra/CMakeLists.txt - -mkdir llvm_build && cd llvm_build -cmake -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" ../llvm -make -``` - -# How to Build *standalone* tool -- Get LLVM and CLANG sources, build them and install to a **LLVM_INSTALL_PATH** folder -- mkdir for hipify, run cmake there and build the tool: -``` -git clone http://llvm.org/git/llvm.git llvm -git clone http://llvm.org/git/clang.git llvm/tools/clang - -mkdir llvm_build && cd llvm_build -cmake -DCMAKE_INSTALL_PREFIX="LLVM_INSTALL_PATH" -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" ../llvm -make && make install - -git clone https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP-hipify.git path_to_hipify_src -mkdir path_to_hipify_src/build && cd path_to_hipify_src/build -cmake -DLLVM_DIR="LLVM_INSTALL_PATH" -DHIPIFY_STANDLONE=1 .. -make -``` - -# How to run tests (for *standalone* tool only) -- install Python and add python-setuptools -- install lit python script -- run tests from path_to_hipify_src/build -``` -sudo apt-get install python python-setuptools -sudo easy_install lit -make -C path_to_hipify_src/build test -``` - -# Notes -- To run, the tool needs "cuda minimal build" package: - 1. Download target installer from https://developer.nvidia.com/cuda-downloads. Choose "deb(network)" installer type to reduce downloaded packages size (we don't need the whole set) - 2. Run `sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb` - 3. Run `sudo apt-get update` - 4. Run `sudo apt-get install cuda-minimal-build-7-5 cuda-curand-dev-7-5` - this will install needed files, (without nvidia drivers, runtime, tools etc.) From aa36e86dc399c7468a790a84a3034229e31c0e95 Mon Sep 17 00:00:00 2001 From: Daniil Fukalov Date: Thu, 7 Apr 2016 01:00:19 +0300 Subject: [PATCH 42/82] reverting accidentially removed files --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5346ea7c69..8c078a91d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,14 @@ set(CMAKE_CXX_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -stdlib=li set(CMAKE_C_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -stdlib=libc++ ") set(SOURCE_FILES src/device_util.cpp -) +src/hip_hcc.cpp +src/hip_device.cpp +src/hip_error.cpp +src/hip_event.cpp +src/hip_memory.cpp +src/hip_peer.cpp +src/hip_stream.cpp +src/staging_buffer.cpp) if(NOT DEFINED ENV{HIP_USE_SHARED_LIBRARY}) set(HIP_USE_SHARED_LIBRARY 0) From c84fdef9d3bdf278c87d8291432f237010bd69f2 Mon Sep 17 00:00:00 2001 From: alex-t Date: Thu, 14 Apr 2016 13:48:58 +0300 Subject: [PATCH 43/82] Fixed incorrect kernel paramlist replacement length & hipGetDeviceProperties mapping --- clang-hipify/src/Cuda2Hip.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang-hipify/src/Cuda2Hip.cpp b/clang-hipify/src/Cuda2Hip.cpp index 65c051ec04..1e29c65010 100644 --- a/clang-hipify/src/Cuda2Hip.cpp +++ b/clang-hipify/src/Cuda2Hip.cpp @@ -215,7 +215,7 @@ struct cuda2hipMap { // Device cuda2hipRename["cudaDeviceProp"] = {"hipDeviceProp_t", CONV_DEV}; - cuda2hipRename["cudaGetDeviceProperties"] = {"hipDeviceGetProperties", + cuda2hipRename["cudaGetDeviceProperties"] = {"hipGetDeviceProperties", CONV_DEV}; // Cache config @@ -492,7 +492,7 @@ public: SourceLocation kernelArgListEnd(pvdLast->getLocEnd()); SourceLocation stop = clang::Lexer::getLocForEndOfToken( kernelArgListEnd, 0, *SM, DefaultLangOptions); - size_t replacementLength = + replacementLength += SM->getCharacterData(stop) - SM->getCharacterData(kernelArgListStart); initialParamList = StringRef(SM->getCharacterData(kernelArgListStart), replacementLength); From 0ff41dd3d99dd6b0a20c58a14e5d7d557a1ee6b6 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Fri, 15 Apr 2016 16:18:48 +0530 Subject: [PATCH 44/82] Fixed location of html documentation in hip_doc package --- packaging/hip_doc.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/hip_doc.txt b/packaging/hip_doc.txt index f4dcbf8728..c80a51cb2b 100644 --- a/packaging/hip_doc.txt +++ b/packaging/hip_doc.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.8.3) project(hip_doc) -install(DIRECTORY @hip_SOURCE_DIR@/docs/RuntimeAPI/html DESTINATION .) +install(DIRECTORY @hip_SOURCE_DIR@/docs/RuntimeAPI/html DESTINATION docs) ############################# # Packaging steps From b72b50612b561f47d1c443e1721aa574fdd75fd3 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Fri, 15 Apr 2016 16:20:35 +0530 Subject: [PATCH 45/82] Handle non-versioned so files being present only in rocm/lib --- bin/hipcc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/hipcc b/bin/hipcc index 22e2dbaa55..d8f296bf21 100755 --- a/bin/hipcc +++ b/bin/hipcc @@ -64,6 +64,9 @@ if ($HIP_PLATFORM eq "hcc") { $HCC_HOME=$ENV{'HCC_HOME'}; $HCC_HOME="/opt/rocm/hcc" unless defined $HCC_HOME; + $ROCM_PATH=$ENV{'ROCM_PATH'}; + $ROCM_PATH="/opt/rocm" unless defined $ROCM_PATH; + # HCC* may be used to compile src/hip_hcc.o (and also feed the HIPCXXFLAGS below) $HCC = "$HCC_HOME/bin/hcc"; $HCCFLAGS = "-hc -I$HCC_HOME/include "; @@ -77,7 +80,7 @@ if ($HIP_PLATFORM eq "hcc") { $HIPLDFLAGS .= " -Wl,--defsym=_binary_kernel_spir_end=0 -Wl,--defsym=_binary_kernel_spir_start=0 -Wl,--defsym=_binary_kernel_cl_start=0 -Wl,--defsym=_binary_kernel_cl_end=0"; # Satisfy HCC dependencies $HIPLDFLAGS .= " -lc++abi"; - $HIPLDFLAGS .= " -L$HSA_PATH/lib -lhsa-runtime64 -lhc_am"; + $HIPLDFLAGS .= " -L$HSA_PATH/lib -L$ROCM_PATH/lib -lhsa-runtime64 -lhc_am"; # Add trace marker library: # TODO - once we cleanly separate the HIP API headers from HIP library headers this logic should move to CMakebuild option - apps do not need to see the marker library. From 9c99b2af1cc9562fd5fd381aa62f8c96ff511085 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Sat, 16 Apr 2016 14:48:05 +0530 Subject: [PATCH 46/82] Remove some stale workweek references --- tests/src/hipDoublePrecisionMathDevice.cpp | 6 ------ tests/src/hipDoublePrecisionMathHost.cpp | 6 ------ tests/src/hipSinglePrecisionMathDevice.cpp | 6 ------ tests/src/hipSinglePrecisionMathHost.cpp | 6 ------ 4 files changed, 24 deletions(-) diff --git a/tests/src/hipDoublePrecisionMathDevice.cpp b/tests/src/hipDoublePrecisionMathDevice.cpp index 7e1d862392..90c8ae1aa6 100644 --- a/tests/src/hipDoublePrecisionMathDevice.cpp +++ b/tests/src/hipDoublePrecisionMathDevice.cpp @@ -42,9 +42,7 @@ __device__ void double_precision_math_functions() copysign(1.0, -2.0); cos(0.0); cosh(0.0); -#if __hcc_workweek__ >= 16073 cospi(0.0); -#endif //cyl_bessel_i0(0.0); //cyl_bessel_i1(0.0); erf(0.0); @@ -102,9 +100,7 @@ __device__ void double_precision_math_functions() //rnorm3d(0.0, 0.0, 1.0); //rnorm4d(0.0, 0.0, 0.0, 1.0); round(0.0); -#if __hcc_workweek__ >= 16073 rsqrt(1.0); -#endif //scalbln(0.0, 1); scalbn(0.0, 1); signbit(1.0); @@ -112,9 +108,7 @@ __device__ void double_precision_math_functions() //sincos(0.0, &fX, &fY); //sincospi(0.0, &fX, &fY); sinh(0.0); -#if __hcc_workweek__ >= 16073 sinpi(0.0); -#endif sqrt(0.0); tan(0.0); tanh(0.0); diff --git a/tests/src/hipDoublePrecisionMathHost.cpp b/tests/src/hipDoublePrecisionMathHost.cpp index d45423a879..461dc5a609 100644 --- a/tests/src/hipDoublePrecisionMathHost.cpp +++ b/tests/src/hipDoublePrecisionMathHost.cpp @@ -42,9 +42,7 @@ __host__ void double_precision_math_functions() copysign(1.0, -2.0); cos(0.0); cosh(0.0); -#if __hcc_workweek__ >= 16073 cospi(0.0); -#endif //cyl_bessel_i0(0.0); //cyl_bessel_i1(0.0); erf(0.0); @@ -102,9 +100,7 @@ __host__ void double_precision_math_functions() //rnorm3d(0.0, 0.0, 1.0); //rnorm4d(0.0, 0.0, 0.0, 1.0); round(0.0); -#if __hcc_workweek__ >= 16073 rsqrt(1.0); -#endif ///scalbln(0.0, 1); scalbn(0.0, 1); signbit(1.0); @@ -112,9 +108,7 @@ __host__ void double_precision_math_functions() sincos(0.0, &fX, &fY); //sincospi(0.0, &fX, &fY); sinh(0.0); -#if __hcc_workweek__ >= 16073 sinpi(0.0); -#endif sqrt(0.0); tan(0.0); tanh(0.0); diff --git a/tests/src/hipSinglePrecisionMathDevice.cpp b/tests/src/hipSinglePrecisionMathDevice.cpp index acb74d3f2d..d97cd03dc9 100644 --- a/tests/src/hipSinglePrecisionMathDevice.cpp +++ b/tests/src/hipSinglePrecisionMathDevice.cpp @@ -42,9 +42,7 @@ __device__ void single_precision_math_functions() copysignf(1.0f, -2.0f); cosf(0.0f); coshf(0.0f); -#if __hcc_workweek__ >= 16073 cospif(0.0f); -#endif //cyl_bessel_i0f(0.0f); //cyl_bessel_i1f(0.0f); erfcf(0.0f); @@ -103,9 +101,7 @@ __device__ void single_precision_math_functions() //rnorm4df(0.0f, 0.0f, 0.0f, 1.0f); //fX = 1.0f; rnormf(1, &fX); roundf(0.0f); -#if __hcc_workweek__ >= 16073 rsqrtf(1.0f); -#endif //scalblnf(0.0f, 1); scalbnf(0.0f, 1); signbit(1.0f); @@ -113,9 +109,7 @@ __device__ void single_precision_math_functions() //sincospif(0.0f, &fX, &fY); sinf(0.0f); sinhf(0.0f); -#if __hcc_workweek__ >= 16073 sinpif(0.0f); -#endif sqrtf(0.0f); tanf(0.0f); tanhf(0.0f); diff --git a/tests/src/hipSinglePrecisionMathHost.cpp b/tests/src/hipSinglePrecisionMathHost.cpp index c12b553e0f..67261a0735 100644 --- a/tests/src/hipSinglePrecisionMathHost.cpp +++ b/tests/src/hipSinglePrecisionMathHost.cpp @@ -42,9 +42,7 @@ __host__ void single_precision_math_functions() copysignf(1.0f, -2.0f); cosf(0.0f); coshf(0.0f); -#if __hcc_workweek__ >= 16073 cospif(0.0f); -#endif //cyl_bessel_i0f(0.0f); //cyl_bessel_i1f(0.0f); erfcf(0.0f); @@ -103,9 +101,7 @@ __host__ void single_precision_math_functions() //rnorm4df(0.0f, 0.0f, 0.0f, 1.0f); //fX = 1.0f; rnormf(1, &fX); roundf(0.0f); -#if __hcc_workweek__ >= 16073 rsqrtf(1.0f); -#endif ///scalblnf(0.0f, 1); scalbnf(0.0f, 1); signbit(1.0f); @@ -113,9 +109,7 @@ __host__ void single_precision_math_functions() //sincospif(0.0f, &fX, &fY); sinf(0.0f); sinhf(0.0f); -#if __hcc_workweek__ >= 16073 sinpif(0.0f); -#endif sqrtf(0.0f); tanf(0.0f); tanhf(0.0f); From dc4c174a5496770eedd3b778f46830255d725a64 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Sat, 16 Apr 2016 14:49:10 +0530 Subject: [PATCH 47/82] Bump min required hcc to workweek 16155 --- include/hcc_detail/hip_runtime_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hcc_detail/hip_runtime_api.h b/include/hcc_detail/hip_runtime_api.h index 013597bba6..79eb369e48 100644 --- a/include/hcc_detail/hip_runtime_api.h +++ b/include/hcc_detail/hip_runtime_api.h @@ -34,7 +34,7 @@ THE SOFTWARE. #include //#include "hip_hcc.h" -#if defined (__HCC__) && (__hcc_workweek__ < 16074) +#if defined (__HCC__) && (__hcc_workweek__ < 16155) #error("This version of HIP requires a newer version of HCC."); #endif From fd49c9eb15ce2fab6f6a28b5bad6fa5b33c0a915 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Sat, 16 Apr 2016 14:55:10 +0530 Subject: [PATCH 48/82] Update doxygen html --- docs/RuntimeAPI/html/Synchonization.html | 4 +- docs/RuntimeAPI/html/annotated.html | 21 +- docs/RuntimeAPI/html/bug.html | 12 +- ...mbers.html => classFakeMutex-members.html} | 13 +- .../{structchar3.html => classFakeMutex.html} | 38 +- .../html/classLockedAccessor-members.html | 105 ++ docs/RuntimeAPI/html/classLockedAccessor.html | 117 ++ docs/RuntimeAPI/html/classes.html | 27 +- ...lassihipDeviceCriticalBase__t-members.html | 116 ++ .../html/classihipDeviceCriticalBase__t.html | 151 +++ .../html/classihipDeviceCriticalBase__t.png | Bin 0 -> 858 bytes ...s.html => classihipDevice__t-members.html} | 42 +- ...Device__t.html => classihipDevice__t.html} | 95 +- ...s.html => classihipException-members.html} | 13 +- docs/RuntimeAPI/html/classihipException.html | 126 ++ docs/RuntimeAPI/html/classihipException.png | Bin 0 -> 435 bytes ...lassihipStreamCriticalBase__t-members.html | 114 ++ .../html/classihipStreamCriticalBase__t.html | 157 +++ .../html/classihipStreamCriticalBase__t.png | Bin 0 -> 854 bytes .../html/classihipStream__t-members.html | 121 ++ docs/RuntimeAPI/html/classihipStream__t.html | 178 +++ .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 18 +- .../dir_6d8604cb65fa6b83549668eb0ce09cac.html | 10 +- .../dir_d44c64559bbebec7f509842c48db8b23.html | 6 +- docs/RuntimeAPI/html/files.html | 28 +- docs/RuntimeAPI/html/functions.html | 11 +- docs/RuntimeAPI/html/functions_vars.html | 3 +- docs/RuntimeAPI/html/globals.html | 95 +- docs/RuntimeAPI/html/globals_defs.html | 3 +- docs/RuntimeAPI/html/globals_enum.html | 3 +- docs/RuntimeAPI/html/globals_eval.html | 3 +- docs/RuntimeAPI/html/globals_func.html | 103 +- docs/RuntimeAPI/html/globals_type.html | 6 +- docs/RuntimeAPI/html/group__API.html | 2 +- docs/RuntimeAPI/html/group__Device.html | 31 +- docs/RuntimeAPI/html/group__Enumerations.html | 173 --- docs/RuntimeAPI/html/group__Error.html | 2 +- docs/RuntimeAPI/html/group__Event.html | 37 +- docs/RuntimeAPI/html/group__GlobalDefs.html | 51 +- docs/RuntimeAPI/html/group__HCC-Specific.html | 96 -- .../RuntimeAPI/html/group__HCC__Specific.html | 78 +- docs/RuntimeAPI/html/group__HIP-ENV.html | 21 +- docs/RuntimeAPI/html/group__Memory.html | 24 +- docs/RuntimeAPI/html/group__PeerToPeer.html | 81 +- docs/RuntimeAPI/html/group__Profiler.html | 2 +- docs/RuntimeAPI/html/group__Stream.html | 35 +- docs/RuntimeAPI/html/group__Texture.html | 8 +- docs/RuntimeAPI/html/group__Version.html | 2 +- .../{globals_vars.html => hcc_8h_source.html} | 51 +- docs/RuntimeAPI/html/hcc__acc_8h_source.html | 118 ++ .../html/hcc__detail_2hip__runtime_8h.html | 308 +---- .../hcc__detail_2hip__runtime_8h_source.html | 1090 ++++++++--------- .../hcc__detail_2hip__runtime__api_8h.html | 104 +- ...__detail_2hip__runtime__api_8h_source.html | 720 +++++------ .../hcc__detail_2hip__vector__types_8h.html | 7 +- ..._detail_2hip__vector__types_8h_source.html | 333 ++--- docs/RuntimeAPI/html/hierarchy.html | 38 +- .../html/hip__common_8h_source.html | 8 +- docs/RuntimeAPI/html/hip__hcc_8cpp.html | 549 +-------- docs/RuntimeAPI/html/hip__hcc_8h_source.html | 815 ++++++++++++ .../html/hip__runtime_8h_source.html | 8 +- .../html/hip__runtime__api_8h_source.html | 196 +-- docs/RuntimeAPI/html/hip__texture_8h.html | 12 +- .../html/hip__texture_8h_source.html | 287 ++--- docs/RuntimeAPI/html/hip__util_8h_source.html | 136 ++ .../html/hip__vector__types_8h_source.html | 20 +- docs/RuntimeAPI/html/host__defines_8h.html | 4 +- .../html/host__defines_8h_source.html | 77 +- docs/RuntimeAPI/html/index.html | 2 +- docs/RuntimeAPI/html/modules.html | 2 +- docs/RuntimeAPI/html/pages.html | 2 +- docs/RuntimeAPI/html/search/all_11.js | 2 +- .../search/{groups_8.html => all_15.html} | 2 +- docs/RuntimeAPI/html/search/all_15.js | 4 + docs/RuntimeAPI/html/search/all_7.js | 1 - docs/RuntimeAPI/html/search/all_8.js | 112 +- docs/RuntimeAPI/html/search/all_9.js | 6 +- docs/RuntimeAPI/html/search/all_a.js | 6 +- docs/RuntimeAPI/html/search/classes_3.js | 8 +- docs/RuntimeAPI/html/search/classes_4.js | 5 +- docs/RuntimeAPI/html/search/classes_5.js | 3 +- docs/RuntimeAPI/html/search/classes_6.js | 2 +- docs/RuntimeAPI/html/search/classes_7.html | 26 - docs/RuntimeAPI/html/search/classes_7.js | 5 - docs/RuntimeAPI/html/search/classes_8.js | 10 - docs/RuntimeAPI/html/search/enumvalues_0.js | 2 + docs/RuntimeAPI/html/search/functions_0.js | 56 +- docs/RuntimeAPI/html/search/groups_8.js | 4 - docs/RuntimeAPI/html/search/search.js | 4 +- docs/RuntimeAPI/html/search/typedefs_1.js | 1 + docs/RuntimeAPI/html/search/variables_2.js | 5 +- .../{classes_8.html => variables_e.html} | 2 +- docs/RuntimeAPI/html/search/variables_e.js | 4 + .../html/staging__buffer_8h_source.html | 165 +++ ...ers.html => structLockedBase-members.html} | 12 +- ...ructtexture.html => structLockedBase.html} | 45 +- docs/RuntimeAPI/html/structLockedBase.png | Bin 0 -> 1178 bytes .../html/structStagingBuffer-members.html | 108 ++ docs/RuntimeAPI/html/structStagingBuffer.html | 131 ++ docs/RuntimeAPI/html/structchar1.html | 111 -- docs/RuntimeAPI/html/structchar2-members.html | 103 -- docs/RuntimeAPI/html/structchar2.html | 114 -- docs/RuntimeAPI/html/structchar3-members.html | 104 -- docs/RuntimeAPI/html/structchar4-members.html | 105 -- docs/RuntimeAPI/html/structchar4.html | 120 -- docs/RuntimeAPI/html/structdim3-members.html | 9 +- docs/RuntimeAPI/html/structdim3.html | 11 +- .../html/structdouble1-members.html | 102 -- docs/RuntimeAPI/html/structdouble1.html | 111 -- .../RuntimeAPI/html/structfloat1-members.html | 102 -- docs/RuntimeAPI/html/structfloat1.html | 111 -- .../structhipChannelFormatDesc-members.html | 2 +- .../html/structhipChannelFormatDesc.html | 4 +- .../html/structhipDeviceArch__t-members.html | 2 +- .../html/structhipDeviceArch__t.html | 4 +- .../html/structhipDeviceProp__t-members.html | 2 +- .../html/structhipDeviceProp__t.html | 4 +- .../html/structhipEvent__t-members.html | 2 +- docs/RuntimeAPI/html/structhipEvent__t.html | 4 +- .../structhipPointerAttribute__t-members.html | 107 ++ .../html/structhipPointerAttribute__t.html | 130 ++ .../html/structihipEvent__t-members.html | 2 +- docs/RuntimeAPI/html/structihipEvent__t.html | 7 +- .../html/structihipSignal__t-members.html | 107 ++ ...tream__t.html => structihipSignal__t.html} | 40 +- docs/RuntimeAPI/html/structint1-members.html | 102 -- docs/RuntimeAPI/html/structint1.html | 111 -- docs/RuntimeAPI/html/structlong1-members.html | 102 -- docs/RuntimeAPI/html/structlong1.html | 111 -- docs/RuntimeAPI/html/structlong2-members.html | 103 -- docs/RuntimeAPI/html/structlong2.html | 114 -- docs/RuntimeAPI/html/structlong3-members.html | 104 -- docs/RuntimeAPI/html/structlong3.html | 117 -- docs/RuntimeAPI/html/structlong4-members.html | 105 -- docs/RuntimeAPI/html/structlong4.html | 120 -- .../html/structlonglong1-members.html | 102 -- docs/RuntimeAPI/html/structlonglong1.html | 111 -- .../html/structlonglong2-members.html | 103 -- docs/RuntimeAPI/html/structlonglong2.html | 114 -- .../html/structlonglong3-members.html | 104 -- docs/RuntimeAPI/html/structlonglong3.html | 117 -- .../html/structlonglong4-members.html | 105 -- docs/RuntimeAPI/html/structlonglong4.html | 120 -- .../RuntimeAPI/html/structshort1-members.html | 102 -- docs/RuntimeAPI/html/structshort1.html | 111 -- .../RuntimeAPI/html/structshort2-members.html | 103 -- docs/RuntimeAPI/html/structshort2.html | 114 -- .../RuntimeAPI/html/structshort3-members.html | 104 -- docs/RuntimeAPI/html/structshort3.html | 117 -- .../RuntimeAPI/html/structshort4-members.html | 105 -- docs/RuntimeAPI/html/structshort4.html | 120 -- docs/RuntimeAPI/html/structtexture.png | Bin 798 -> 0 bytes .../html/structtextureReference-members.html | 2 +- .../html/structtextureReference.html | 13 +- .../html/structtextureReference.png | Bin 808 -> 0 bytes .../RuntimeAPI/html/structuchar1-members.html | 102 -- docs/RuntimeAPI/html/structuchar1.html | 111 -- .../RuntimeAPI/html/structuchar2-members.html | 103 -- docs/RuntimeAPI/html/structuchar2.html | 114 -- .../RuntimeAPI/html/structuchar3-members.html | 104 -- docs/RuntimeAPI/html/structuchar3.html | 117 -- .../RuntimeAPI/html/structuchar4-members.html | 105 -- docs/RuntimeAPI/html/structuchar4.html | 120 -- docs/RuntimeAPI/html/structuint1-members.html | 102 -- docs/RuntimeAPI/html/structuint1.html | 111 -- .../RuntimeAPI/html/structulong1-members.html | 102 -- docs/RuntimeAPI/html/structulong1.html | 111 -- .../RuntimeAPI/html/structulong2-members.html | 103 -- docs/RuntimeAPI/html/structulong2.html | 114 -- .../RuntimeAPI/html/structulong3-members.html | 104 -- docs/RuntimeAPI/html/structulong3.html | 117 -- .../RuntimeAPI/html/structulong4-members.html | 105 -- docs/RuntimeAPI/html/structulong4.html | 120 -- .../html/structulonglong1-members.html | 102 -- docs/RuntimeAPI/html/structulonglong1.html | 111 -- .../html/structulonglong2-members.html | 103 -- docs/RuntimeAPI/html/structulonglong2.html | 114 -- .../html/structulonglong3-members.html | 104 -- docs/RuntimeAPI/html/structulonglong3.html | 117 -- .../html/structulonglong4-members.html | 105 -- docs/RuntimeAPI/html/structulonglong4.html | 120 -- .../html/structushort1-members.html | 102 -- docs/RuntimeAPI/html/structushort1.html | 111 -- .../html/structushort2-members.html | 103 -- docs/RuntimeAPI/html/structushort2.html | 114 -- .../html/structushort3-members.html | 104 -- docs/RuntimeAPI/html/structushort3.html | 117 -- .../html/structushort4-members.html | 105 -- docs/RuntimeAPI/html/structushort4.html | 120 -- .../html/trace__helper_8h_source.html | 231 ++++ 190 files changed, 5431 insertions(+), 10893 deletions(-) rename docs/RuntimeAPI/html/{structtexture-members.html => classFakeMutex-members.html} (79%) rename docs/RuntimeAPI/html/{structchar3.html => classFakeMutex.html} (70%) create mode 100644 docs/RuntimeAPI/html/classLockedAccessor-members.html create mode 100644 docs/RuntimeAPI/html/classLockedAccessor.html create mode 100644 docs/RuntimeAPI/html/classihipDeviceCriticalBase__t-members.html create mode 100644 docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.html create mode 100644 docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.png rename docs/RuntimeAPI/html/{structihipDevice__t-members.html => classihipDevice__t-members.html} (55%) rename docs/RuntimeAPI/html/{structihipDevice__t.html => classihipDevice__t.html} (62%) rename docs/RuntimeAPI/html/{structihipStream__t-members.html => classihipException-members.html} (77%) create mode 100644 docs/RuntimeAPI/html/classihipException.html create mode 100644 docs/RuntimeAPI/html/classihipException.png create mode 100644 docs/RuntimeAPI/html/classihipStreamCriticalBase__t-members.html create mode 100644 docs/RuntimeAPI/html/classihipStreamCriticalBase__t.html create mode 100644 docs/RuntimeAPI/html/classihipStreamCriticalBase__t.png create mode 100644 docs/RuntimeAPI/html/classihipStream__t-members.html create mode 100644 docs/RuntimeAPI/html/classihipStream__t.html delete mode 100644 docs/RuntimeAPI/html/group__Enumerations.html delete mode 100644 docs/RuntimeAPI/html/group__HCC-Specific.html rename docs/RuntimeAPI/html/{globals_vars.html => hcc_8h_source.html} (73%) create mode 100644 docs/RuntimeAPI/html/hcc__acc_8h_source.html create mode 100644 docs/RuntimeAPI/html/hip__hcc_8h_source.html create mode 100644 docs/RuntimeAPI/html/hip__util_8h_source.html rename docs/RuntimeAPI/html/search/{groups_8.html => all_15.html} (94%) create mode 100644 docs/RuntimeAPI/html/search/all_15.js delete mode 100644 docs/RuntimeAPI/html/search/classes_7.html delete mode 100644 docs/RuntimeAPI/html/search/classes_7.js delete mode 100644 docs/RuntimeAPI/html/search/classes_8.js delete mode 100644 docs/RuntimeAPI/html/search/groups_8.js rename docs/RuntimeAPI/html/search/{classes_8.html => variables_e.html} (93%) create mode 100644 docs/RuntimeAPI/html/search/variables_e.js create mode 100644 docs/RuntimeAPI/html/staging__buffer_8h_source.html rename docs/RuntimeAPI/html/{structchar1-members.html => structLockedBase-members.html} (71%) rename docs/RuntimeAPI/html/{structtexture.html => structLockedBase.html} (66%) create mode 100644 docs/RuntimeAPI/html/structLockedBase.png create mode 100644 docs/RuntimeAPI/html/structStagingBuffer-members.html create mode 100644 docs/RuntimeAPI/html/structStagingBuffer.html delete mode 100644 docs/RuntimeAPI/html/structchar1.html delete mode 100644 docs/RuntimeAPI/html/structchar2-members.html delete mode 100644 docs/RuntimeAPI/html/structchar2.html delete mode 100644 docs/RuntimeAPI/html/structchar3-members.html delete mode 100644 docs/RuntimeAPI/html/structchar4-members.html delete mode 100644 docs/RuntimeAPI/html/structchar4.html delete mode 100644 docs/RuntimeAPI/html/structdouble1-members.html delete mode 100644 docs/RuntimeAPI/html/structdouble1.html delete mode 100644 docs/RuntimeAPI/html/structfloat1-members.html delete mode 100644 docs/RuntimeAPI/html/structfloat1.html create mode 100644 docs/RuntimeAPI/html/structhipPointerAttribute__t-members.html create mode 100644 docs/RuntimeAPI/html/structhipPointerAttribute__t.html create mode 100644 docs/RuntimeAPI/html/structihipSignal__t-members.html rename docs/RuntimeAPI/html/{structihipStream__t.html => structihipSignal__t.html} (77%) delete mode 100644 docs/RuntimeAPI/html/structint1-members.html delete mode 100644 docs/RuntimeAPI/html/structint1.html delete mode 100644 docs/RuntimeAPI/html/structlong1-members.html delete mode 100644 docs/RuntimeAPI/html/structlong1.html delete mode 100644 docs/RuntimeAPI/html/structlong2-members.html delete mode 100644 docs/RuntimeAPI/html/structlong2.html delete mode 100644 docs/RuntimeAPI/html/structlong3-members.html delete mode 100644 docs/RuntimeAPI/html/structlong3.html delete mode 100644 docs/RuntimeAPI/html/structlong4-members.html delete mode 100644 docs/RuntimeAPI/html/structlong4.html delete mode 100644 docs/RuntimeAPI/html/structlonglong1-members.html delete mode 100644 docs/RuntimeAPI/html/structlonglong1.html delete mode 100644 docs/RuntimeAPI/html/structlonglong2-members.html delete mode 100644 docs/RuntimeAPI/html/structlonglong2.html delete mode 100644 docs/RuntimeAPI/html/structlonglong3-members.html delete mode 100644 docs/RuntimeAPI/html/structlonglong3.html delete mode 100644 docs/RuntimeAPI/html/structlonglong4-members.html delete mode 100644 docs/RuntimeAPI/html/structlonglong4.html delete mode 100644 docs/RuntimeAPI/html/structshort1-members.html delete mode 100644 docs/RuntimeAPI/html/structshort1.html delete mode 100644 docs/RuntimeAPI/html/structshort2-members.html delete mode 100644 docs/RuntimeAPI/html/structshort2.html delete mode 100644 docs/RuntimeAPI/html/structshort3-members.html delete mode 100644 docs/RuntimeAPI/html/structshort3.html delete mode 100644 docs/RuntimeAPI/html/structshort4-members.html delete mode 100644 docs/RuntimeAPI/html/structshort4.html delete mode 100644 docs/RuntimeAPI/html/structtexture.png delete mode 100644 docs/RuntimeAPI/html/structtextureReference.png delete mode 100644 docs/RuntimeAPI/html/structuchar1-members.html delete mode 100644 docs/RuntimeAPI/html/structuchar1.html delete mode 100644 docs/RuntimeAPI/html/structuchar2-members.html delete mode 100644 docs/RuntimeAPI/html/structuchar2.html delete mode 100644 docs/RuntimeAPI/html/structuchar3-members.html delete mode 100644 docs/RuntimeAPI/html/structuchar3.html delete mode 100644 docs/RuntimeAPI/html/structuchar4-members.html delete mode 100644 docs/RuntimeAPI/html/structuchar4.html delete mode 100644 docs/RuntimeAPI/html/structuint1-members.html delete mode 100644 docs/RuntimeAPI/html/structuint1.html delete mode 100644 docs/RuntimeAPI/html/structulong1-members.html delete mode 100644 docs/RuntimeAPI/html/structulong1.html delete mode 100644 docs/RuntimeAPI/html/structulong2-members.html delete mode 100644 docs/RuntimeAPI/html/structulong2.html delete mode 100644 docs/RuntimeAPI/html/structulong3-members.html delete mode 100644 docs/RuntimeAPI/html/structulong3.html delete mode 100644 docs/RuntimeAPI/html/structulong4-members.html delete mode 100644 docs/RuntimeAPI/html/structulong4.html delete mode 100644 docs/RuntimeAPI/html/structulonglong1-members.html delete mode 100644 docs/RuntimeAPI/html/structulonglong1.html delete mode 100644 docs/RuntimeAPI/html/structulonglong2-members.html delete mode 100644 docs/RuntimeAPI/html/structulonglong2.html delete mode 100644 docs/RuntimeAPI/html/structulonglong3-members.html delete mode 100644 docs/RuntimeAPI/html/structulonglong3.html delete mode 100644 docs/RuntimeAPI/html/structulonglong4-members.html delete mode 100644 docs/RuntimeAPI/html/structulonglong4.html delete mode 100644 docs/RuntimeAPI/html/structushort1-members.html delete mode 100644 docs/RuntimeAPI/html/structushort1.html delete mode 100644 docs/RuntimeAPI/html/structushort2-members.html delete mode 100644 docs/RuntimeAPI/html/structushort2.html delete mode 100644 docs/RuntimeAPI/html/structushort3-members.html delete mode 100644 docs/RuntimeAPI/html/structushort3.html delete mode 100644 docs/RuntimeAPI/html/structushort4-members.html delete mode 100644 docs/RuntimeAPI/html/structushort4.html create mode 100644 docs/RuntimeAPI/html/trace__helper_8h_source.html diff --git a/docs/RuntimeAPI/html/Synchonization.html b/docs/RuntimeAPI/html/Synchonization.html index d1d49391dd..198f1d8d55 100644 --- a/docs/RuntimeAPI/html/Synchonization.html +++ b/docs/RuntimeAPI/html/Synchonization.html @@ -79,7 +79,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

The following commands are "host-asynchronous" - meaning they do not wait for any preceding commands to complete, and may return control to the host thread before the requested operation completes:

  • Kernel launches (hipLaunchKernel() )
  • -
  • Asynchronous memory copies - any memory copy API which contains "Async", such as hipMemcpyAsync())
  • +
  • Asynchronous memory copies - any memory copy API which contains "Async", such as hipMemcpyAsync())
  • Any memory set (for example, hipMemset());
  • TODO
@@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/annotated.html b/docs/RuntimeAPI/html/annotated.html index 1d7e7e2a5b..7aad966bcb 100644 --- a/docs/RuntimeAPI/html/annotated.html +++ b/docs/RuntimeAPI/html/annotated.html @@ -96,20 +96,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); oChipDeviceProp_t oChipEvent_t oChipPointerAttribute_t -oCihipDevice_t -oCihipEvent_t -oCihipException -oCihipSignal_t -oCihipStream_t -oCStagingBuffer -oCtexture -\CtextureReference +oCihipDevice_t +oCihipDeviceCriticalBase_t +oCihipEvent_t +oCihipException +oCihipSignal_t +oCihipStream_t +oCihipStreamCriticalBase_t +oCLockedAccessor +oCLockedBase +oCStagingBuffer +\CtextureReference diff --git a/docs/RuntimeAPI/html/bug.html b/docs/RuntimeAPI/html/bug.html index ef94caaa9f..b017f3a1b0 100644 --- a/docs/RuntimeAPI/html/bug.html +++ b/docs/RuntimeAPI/html/bug.html @@ -80,22 +80,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
Member hipGetDeviceProperties (hipDeviceProp_t *prop, int device)
+
Member hipGetDeviceProperties (hipDeviceProp_t *prop, int device)

HCC always returns 0 for maxThreadsPerMultiProcessor

HCC always returns 0 for regsPerBlock

HCC always returns 0 for l2CacheSize

-
Member hipMemcpyPeerAsync (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream=0)
+
Member hipMemcpyPeerAsync (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream)
This function uses a synchronous copy
-
Member hipStreamWaitEvent (hipStream_t stream, hipEvent_t event, unsigned int flags)
-
This function conservatively waits for all work in the specified stream to complete.
-
Member ihipDevice_t::getProperties (hipDeviceProp_t *prop)
-
: on HCC, isMultiGpuBoard returns True if system contains multiple GPUS (rather than if GPU is on a multi-ASIC board)
+
Member hipStreamWaitEvent (hipStream_t stream, hipEvent_t event, unsigned int flags)
+
This function conservatively waits for all work in the specified stream to complete.
diff --git a/docs/RuntimeAPI/html/structtexture-members.html b/docs/RuntimeAPI/html/classFakeMutex-members.html similarity index 79% rename from docs/RuntimeAPI/html/structtexture-members.html rename to docs/RuntimeAPI/html/classFakeMutex-members.html index 04556bf525..bd3173d921 100644 --- a/docs/RuntimeAPI/html/structtexture-members.html +++ b/docs/RuntimeAPI/html/classFakeMutex-members.html @@ -84,20 +84,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
texture< T, texType, hipTextureReadMode > Member List
+
FakeMutex Member List
-

This is the complete list of members for texture< T, texType, hipTextureReadMode >, including all inherited members.

+

This is the complete list of members for FakeMutex, including all inherited members.

- - - - + + +
_dataPtr (defined in texture< T, texType, hipTextureReadMode >)texture< T, texType, hipTextureReadMode >
channelDesc (defined in textureReference)textureReference
filterMode (defined in textureReference)textureReference
normalized (defined in textureReference)textureReference
lock() (defined in FakeMutex)FakeMutexinline
try_lock() (defined in FakeMutex)FakeMutexinline
unlock() (defined in FakeMutex)FakeMutexinline
diff --git a/docs/RuntimeAPI/html/structchar3.html b/docs/RuntimeAPI/html/classFakeMutex.html similarity index 70% rename from docs/RuntimeAPI/html/structchar3.html rename to docs/RuntimeAPI/html/classFakeMutex.html index bc38841645..99265880e5 100644 --- a/docs/RuntimeAPI/html/structchar3.html +++ b/docs/RuntimeAPI/html/classFakeMutex.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: char3 Struct Reference +HIP: Heterogenous-computing Interface for Portability: FakeMutex Class Reference @@ -72,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Enumerations Enumerator Macros Groups Pages + All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
@@ -84,32 +84,32 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
char3 Struct Reference
+
FakeMutex Class Reference
- - - - - - - + + + + + + +

-Public Attributes

-char x
 
-char y
 
-char z
 

+Public Member Functions

+void lock ()
 
+bool try_lock ()
 
+void unlock ()
 
-
The documentation for this struct was generated from the following file:
    -
  • /home/bensander/hip/include/hcc_detail/hip_vector_types.h
  • +
    The documentation for this class was generated from the following file:
      +
    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
diff --git a/docs/RuntimeAPI/html/classLockedAccessor-members.html b/docs/RuntimeAPI/html/classLockedAccessor-members.html new file mode 100644 index 0000000000..0440c28c7e --- /dev/null +++ b/docs/RuntimeAPI/html/classLockedAccessor-members.html @@ -0,0 +1,105 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: Member List + + + + + + + + + +
+
+ + + + + + +
+
HIP: Heterogenous-computing Interface for Portability +
+
+
+ + + + + + + + + +
+ +
+ +
+
+
+
LockedAccessor< T > Member List
+
+
+ +

This is the complete list of members for LockedAccessor< T >, including all inherited members.

+ + + + + +
LockedAccessor(T &criticalData, bool autoUnlock=true) (defined in LockedAccessor< T >)LockedAccessor< T >inline
operator->() (defined in LockedAccessor< T >)LockedAccessor< T >inline
unlock() (defined in LockedAccessor< T >)LockedAccessor< T >inline
~LockedAccessor() (defined in LockedAccessor< T >)LockedAccessor< T >inline
+ + + + diff --git a/docs/RuntimeAPI/html/classLockedAccessor.html b/docs/RuntimeAPI/html/classLockedAccessor.html new file mode 100644 index 0000000000..1712e382f9 --- /dev/null +++ b/docs/RuntimeAPI/html/classLockedAccessor.html @@ -0,0 +1,117 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: LockedAccessor< T > Class Template Reference + + + + + + + + + +
+
+ + + + + + +
+
HIP: Heterogenous-computing Interface for Portability +
+
+
+ + + + + + + + + +
+ +
+ +
+
+ +
+
LockedAccessor< T > Class Template Reference
+
+
+ + + + + + + + +

+Public Member Functions

LockedAccessor (T &criticalData, bool autoUnlock=true)
 
+void unlock ()
 
+T * operator-> ()
 
+
The documentation for this class was generated from the following file:
    +
  • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
  • +
+
+ + + + diff --git a/docs/RuntimeAPI/html/classes.html b/docs/RuntimeAPI/html/classes.html index 205d994eda..a36250a427 100644 --- a/docs/RuntimeAPI/html/classes.html +++ b/docs/RuntimeAPI/html/classes.html @@ -87,28 +87,31 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Class Index
-
D | F | H | I | S | T
+
D | F | H | I | L | S | T
+ + + - - - + + + - - + +
  F  
+
  S  
+
hipDeviceArch_t   ihipDeviceCriticalBase_t   
hipDeviceProp_t   ihipEvent_t   
FakeMutex   StagingBuffer   hipEvent_t   ihipException   
  L  
  d  
-
hipDeviceArch_t   ihipEvent_t   textureReference   
hipDeviceProp_t   ihipException   
FakeMutex   dim3   hipEvent_t   ihipSignal_t   
  S  
-
  h  
-
hipPointerAttribute_t   ihipStream_t   
hipPointerAttribute_t   ihipSignal_t   
  i  
-
  t  
+
ihipStream_t   
LockedAccessor   dim3   ihipStreamCriticalBase_t   
LockedBase   
  h  
+
ihipDevice_t   
  t  
StagingBuffer   hipChannelFormatDesc   
ihipDevice_t   texture   
hipChannelFormatDesc   textureReference   
-
D | F | H | I | S | T
+
D | F | H | I | L | S | T
diff --git a/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t-members.html b/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t-members.html new file mode 100644 index 0000000000..02331c2b9e --- /dev/null +++ b/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t-members.html @@ -0,0 +1,116 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: Member List + + + + + + + + + +
+
+ + + + + + +
+
HIP: Heterogenous-computing Interface for Portability +
+
+
+ + + + + + + + + +
+ +
+ +
+
+
+
ihipDeviceCriticalBase_t< MUTEX_TYPE > Member List
+
+
+ +

This is the complete list of members for ihipDeviceCriticalBase_t< MUTEX_TYPE >, including all inherited members.

+ + + + + + + + + + + + + + + + +
_mutex (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >private
addPeer(ihipDevice_t *peer) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >
const_streams() const (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
ihipDeviceCriticalBase_t() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
incStreamId() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
init(unsigned deviceCnt) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
lock() (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >inlineprivate
LockedAccessor< ihipDeviceCriticalBase_t > (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >friend
peerAgents() const (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
peerCnt() const (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
removePeer(ihipDevice_t *peer) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >
resetPeers(ihipDevice_t *thisDevice) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >
streams() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
unlock() (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >inlineprivate
~ihipDeviceCriticalBase_t() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
+ + + + diff --git a/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.html b/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.html new file mode 100644 index 0000000000..91ecb9dfe3 --- /dev/null +++ b/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.html @@ -0,0 +1,151 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: ihipDeviceCriticalBase_t< MUTEX_TYPE > Class Template Reference + + + + + + + + + +
+
+ + + + + + +
+
HIP: Heterogenous-computing Interface for Portability +
+
+
+ + + + + + + + + +
+ +
+ +
+
+ +
+
ihipDeviceCriticalBase_t< MUTEX_TYPE > Class Template Reference
+
+
+
+Inheritance diagram for ihipDeviceCriticalBase_t< MUTEX_TYPE >:
+
+
+ + +LockedBase< MUTEX_TYPE > + +
+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

+void init (unsigned deviceCnt)
 
+std::list< ihipStream_t * > & streams ()
 
+const std::list< ihipStream_t * > & const_streams () const
 
+ihipStream_t::SeqNum_t incStreamId ()
 
+bool addPeer (ihipDevice_t *peer)
 
+bool removePeer (ihipDevice_t *peer)
 
+void resetPeers (ihipDevice_t *thisDevice)
 
+uint32_t peerCnt () const
 
+hsa_agent_t * peerAgents () const
 
+ + + +

+Friends

+class LockedAccessor< ihipDeviceCriticalBase_t >
 
+
The documentation for this class was generated from the following file:
    +
  • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
  • +
+
+ + + + diff --git a/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.png b/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.png new file mode 100644 index 0000000000000000000000000000000000000000..5b18856aede969ef3eb655468868428e108f054f GIT binary patch literal 858 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K50yvm~z~eueQ$m7WHO5 zlg1kE-tef3>OmbU%J-wGULh$zNL*Tir+J6m@Q|Rv$}OV!dwkn*Sxz~o( zC;NhFe0Eh1GdIIF_Kpr4pbuSK>gNCBXE@HczwlOf$C;^;6BvXVIy_=j8(21g0))YS zm43sCF1`n^wJjQ7Fz9_et|lPI;85`NAG1qX8iPYhDjNgwjK39ZIk&gDib*?wEC5E{ zqg9MM?);i;r@*i#&H2=a4<-_^$DjRs_hX&?>cgjtvft~S$v$w*Ir9IaL~*Cs{WSyN5dE1JidGP?RP%C zw=Ui4{Qf{c3PKenaP^{xvP*tcn+ieTWg`N`5Egp9d zmHgN$6U$tw#avS@BOO!wKZorFZz21!T87g?Genju+?mfW+~XUW|@z|^3-HI;Gg z`ND?y74@tKHah0ld=F)x$vClz^@A4!rvf9xk*ll+w&g}A{AFyPXj*k~Y4IgsMqu!C L^>bP0l+XkKCwzE6 literal 0 HcmV?d00001 diff --git a/docs/RuntimeAPI/html/structihipDevice__t-members.html b/docs/RuntimeAPI/html/classihipDevice__t-members.html similarity index 55% rename from docs/RuntimeAPI/html/structihipDevice__t-members.html rename to docs/RuntimeAPI/html/classihipDevice__t-members.html index 18910d1c14..bc1a11bd75 100644 --- a/docs/RuntimeAPI/html/structihipDevice__t-members.html +++ b/docs/RuntimeAPI/html/classihipDevice__t-members.html @@ -88,33 +88,29 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-

This is the complete list of members for ihipDevice_t, including all inherited members.

+

This is the complete list of members for ihipDevice_t, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
_acc (defined in ihipDevice_t)ihipDevice_t
_compute_units (defined in ihipDevice_t)ihipDevice_t
_copy_lock (defined in ihipDevice_t)ihipDevice_t
_default_stream (defined in ihipDevice_t)ihipDevice_t
_device_index (defined in ihipDevice_t)ihipDevice_t
_hsa_agent (defined in ihipDevice_t)ihipDevice_t
_null_stream (defined in ihipDevice_t)ihipDevice_t
_props (defined in ihipDevice_t)ihipDevice_t
_staging_buffer (defined in ihipDevice_t)ihipDevice_t
_stream_id (defined in ihipDevice_t)ihipDevice_t
_streams (defined in ihipDevice_t)ihipDevice_t
getProperties(hipDeviceProp_t *prop)ihipDevice_t
getProperties(hipDeviceProp_t *prop) (defined in ihipDevice_t)ihipDevice_t
init(unsigned device_index, hc::accelerator acc) (defined in ihipDevice_t)ihipDevice_t
init(unsigned device_index, hc::accelerator acc) (defined in ihipDevice_t)ihipDevice_t
reset() (defined in ihipDevice_t)ihipDevice_t
reset() (defined in ihipDevice_t)ihipDevice_t
syncDefaultStream(bool waitOnSelf) (defined in ihipDevice_t)ihipDevice_tinline
waitAllStreams() (defined in ihipDevice_t)ihipDevice_tinline
~ihipDevice_t() (defined in ihipDevice_t)ihipDevice_t
~ihipDevice_t() (defined in ihipDevice_t)ihipDevice_t
_acc (defined in ihipDevice_t)ihipDevice_t
_compute_units (defined in ihipDevice_t)ihipDevice_t
_default_stream (defined in ihipDevice_t)ihipDevice_t
_device_flags (defined in ihipDevice_t)ihipDevice_t
_device_index (defined in ihipDevice_t)ihipDevice_t
_hsa_agent (defined in ihipDevice_t)ihipDevice_t
_props (defined in ihipDevice_t)ihipDevice_t
_staging_buffer (defined in ihipDevice_t)ihipDevice_t
criticalData() (defined in ihipDevice_t)ihipDevice_tinline
ihipDevice_t() (defined in ihipDevice_t)ihipDevice_tinline
init(unsigned device_index, unsigned deviceCnt, hc::accelerator &acc, unsigned flags) (defined in ihipDevice_t)ihipDevice_t
locked_addStream(ihipStream_t *s) (defined in ihipDevice_t)ihipDevice_t
locked_removeStream(ihipStream_t *s) (defined in ihipDevice_t)ihipDevice_t
locked_reset() (defined in ihipDevice_t)ihipDevice_t
locked_syncDefaultStream(bool waitOnSelf) (defined in ihipDevice_t)ihipDevice_t
locked_waitAllStreams() (defined in ihipDevice_t)ihipDevice_t
~ihipDevice_t() (defined in ihipDevice_t)ihipDevice_t
diff --git a/docs/RuntimeAPI/html/structihipDevice__t.html b/docs/RuntimeAPI/html/classihipDevice__t.html similarity index 62% rename from docs/RuntimeAPI/html/structihipDevice__t.html rename to docs/RuntimeAPI/html/classihipDevice__t.html index 9b98762848..9f3ed0481d 100644 --- a/docs/RuntimeAPI/html/structihipDevice__t.html +++ b/docs/RuntimeAPI/html/classihipDevice__t.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: ihipDevice_t Struct Reference +HIP: Heterogenous-computing Interface for Portability: ihipDevice_t Class Reference @@ -86,37 +86,35 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); +List of all members
-
ihipDevice_t Struct Reference
+
ihipDevice_t Class Reference
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + +

Public Member Functions

-void init (unsigned device_index, hc::accelerator acc)
 
-void reset ()
 
hipError_t getProperties (hipDeviceProp_t *prop)
 
-void waitAllStreams ()
 
-void syncDefaultStream (bool waitOnSelf)
 
-void reset ()
 
-void init (unsigned device_index, hc::accelerator acc)
 
-hipError_t getProperties (hipDeviceProp_t *prop)
 
+void init (unsigned device_index, unsigned deviceCnt, hc::accelerator &acc, unsigned flags)
 
+void locked_addStream (ihipStream_t *s)
 
+void locked_removeStream (ihipStream_t *s)
 
+void locked_reset ()
 
+void locked_waitAllStreams ()
 
+void locked_syncDefaultStream (bool waitOnSelf)
 
+ihipDeviceCritical_tcriticalData ()
 
@@ -135,51 +133,24 @@ hsa_agent_t  - - - - - - - - - - + + +

Public Attributes

_hsa_agent
ihipStream_t_default_stream
 
-std::list< ihipStream_t * > _streams
 
unsigned _compute_units
 
+
StagingBuffer_staging_buffer [2]
 
-ihipStream_t::SeqNum_t _stream_id
 
-ihipStream_t_null_stream
 
-std::mutex _copy_lock [2]
 
 
+unsigned _device_flags
 
-

Member Function Documentation

- -
-
- - - - - - - - -
hipError_t ihipDevice_t::getProperties (hipDeviceProp_tprop)
-
-
Bug:
: on HCC, isMultiGpuBoard returns True if system contains multiple GPUS (rather than if GPU is on a multi-ASIC board)
- -
-
-
The documentation for this struct was generated from the following files:
    -
  • /home/bensander/HIP-privatestaging/src/hip_hcc.cpp
  • -
  • /home/bensander/HIP-privatestaging/src/hip_hcc2.cpp
  • +
    The documentation for this class was generated from the following files:
      +
    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
    • +
    • /home/mangupta/hip_git/rel0.84.0/src/hip_hcc.cpp
diff --git a/docs/RuntimeAPI/html/structihipStream__t-members.html b/docs/RuntimeAPI/html/classihipException-members.html similarity index 77% rename from docs/RuntimeAPI/html/structihipStream__t-members.html rename to docs/RuntimeAPI/html/classihipException-members.html index 57df3ae1ba..937af05387 100644 --- a/docs/RuntimeAPI/html/structihipStream__t-members.html +++ b/docs/RuntimeAPI/html/classihipException-members.html @@ -84,21 +84,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
ihipStream_t Member List
+
ihipException Member List
-

This is the complete list of members for ihipStream_t, including all inherited members.

+

This is the complete list of members for ihipException, including all inherited members.

- - - - - + +
_av (defined in ihipStream_t)ihipStream_t
_device_index (defined in ihipStream_t)ihipStream_t
_flags (defined in ihipStream_t)ihipStream_t
_last_command (defined in ihipStream_t)ihipStream_t
ihipStream_t(unsigned device_index, hc::accelerator_view av, unsigned int flags) (defined in ihipStream_t)ihipStream_tinline
_code (defined in ihipException)ihipException
ihipException(hipError_t e) (defined in ihipException)ihipExceptioninline
diff --git a/docs/RuntimeAPI/html/classihipException.html b/docs/RuntimeAPI/html/classihipException.html new file mode 100644 index 0000000000..1e57d7e471 --- /dev/null +++ b/docs/RuntimeAPI/html/classihipException.html @@ -0,0 +1,126 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: ihipException Class Reference + + + + + + + + + +
+
+ + + + + + +
+
HIP: Heterogenous-computing Interface for Portability +
+
+
+ + + + + + + + + +
+ +
+ +
+
+ +
+
ihipException Class Reference
+
+
+
+Inheritance diagram for ihipException:
+
+
+ + + +
+ + + + +

+Public Member Functions

ihipException (hipError_t e)
 
+ + + +

+Public Attributes

+hipError_t _code
 
+
The documentation for this class was generated from the following file:
    +
  • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
  • +
+
+ + + + diff --git a/docs/RuntimeAPI/html/classihipException.png b/docs/RuntimeAPI/html/classihipException.png new file mode 100644 index 0000000000000000000000000000000000000000..36add951e6d298079acb4b2f570e4ac87eab64cf GIT binary patch literal 435 zcmV;k0ZjghP)vTJkN^MxkN^Mxkifve1&Q1r00008bW%=J0RR90|NsC0)yh;d0003(NklPw?q0nLoN!SwatebnRKwNV%#_cmm(m|jk-LByNLhiccY}I$U zl60gIckRBiHjU}!HEa~kE_4nNpZlC=>xeR^*8 zUE|tIH~AiyNRqYPI+S~xsP8QIv>(#L_QNb!lE#{k{o7ngnp1Gyxg>eN0AN-N0655r zyDUCnC+>=M0ef*jt{;LMTmaRA8{FUmK&#*e_up_y(m@~q+^*pM5O*EwtZ5Yh*i~Hy zz?jW<6EJa=|uST`LEjJ&knVG}B_w0jv->AM_T&ZuLeIMNV z&bjph&5FF&9o(iWo3y{e-IB`v9M|_e-%{54&ou6b^sxP~Yp?$DhUpfNKh_ dJC`Ky*8`7!Gj#ISOkMy0002ovPDHLkV1npj(69gi literal 0 HcmV?d00001 diff --git a/docs/RuntimeAPI/html/classihipStreamCriticalBase__t-members.html b/docs/RuntimeAPI/html/classihipStreamCriticalBase__t-members.html new file mode 100644 index 0000000000..60f9c4996e --- /dev/null +++ b/docs/RuntimeAPI/html/classihipStreamCriticalBase__t-members.html @@ -0,0 +1,114 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: Member List + + + + + + + + + +
+
+ + + + + + +
+
HIP: Heterogenous-computing Interface for Portability +
+
+
+ + + + + + + + + +
+ +
+ +
+
+
+
ihipStreamCriticalBase_t< MUTEX_TYPE > Member List
+
+ + + + + diff --git a/docs/RuntimeAPI/html/classihipStreamCriticalBase__t.html b/docs/RuntimeAPI/html/classihipStreamCriticalBase__t.html new file mode 100644 index 0000000000..96f9d656fc --- /dev/null +++ b/docs/RuntimeAPI/html/classihipStreamCriticalBase__t.html @@ -0,0 +1,157 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: ihipStreamCriticalBase_t< MUTEX_TYPE > Class Template Reference + + + + + + + + + +
+
+ + + + + + +
+
HIP: Heterogenous-computing Interface for Portability +
+
+
+ + + + + + + + + +
+ +
+ +
+
+ +
+
ihipStreamCriticalBase_t< MUTEX_TYPE > Class Template Reference
+
+
+
+Inheritance diagram for ihipStreamCriticalBase_t< MUTEX_TYPE >:
+
+
+ + +LockedBase< MUTEX_TYPE > + +
+ + + + + + + + + +

+Public Member Functions

+ihipStreamCriticalBase_t
+< StreamMutex > * 
mlock ()
 
- Public Member Functions inherited from LockedBase< MUTEX_TYPE >
+void lock ()
 
+void unlock ()
 
+ + + + + + + + + + + + + + + + + + +

+Public Attributes

+ihipCommand_t _last_command_type
 
+ihipSignal_t_last_copy_signal
 
+hc::completion_future _last_kernel_future
 
+int _signalCursor
 
+SIGSEQNUM _oldest_live_sig_id
 
+std::deque< ihipSignal_t_signalPool
 
+SIGSEQNUM _stream_sig_id
 
- Public Attributes inherited from LockedBase< MUTEX_TYPE >
+MUTEX_TYPE _mutex
 
+
The documentation for this class was generated from the following file:
    +
  • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
  • +
+
+ + + + diff --git a/docs/RuntimeAPI/html/classihipStreamCriticalBase__t.png b/docs/RuntimeAPI/html/classihipStreamCriticalBase__t.png new file mode 100644 index 0000000000000000000000000000000000000000..4d8990f4ca2ca48ac6b812c10391032bb5bb60eb GIT binary patch literal 854 zcmeAS@N?(olHy`uVBq!ia0vp^|A9DwgBeIZoD+N)NJ#|vgt-3y4-$Xz=4)yHp$R}1 z7#}!rfVK0EJdn##666=m08|75S5Ji)F)%Pa^>lFzsbG9N_w}?}20U!XPg(ByuWa6+ zKS_TAL-ehw+kSH0*z{(i&Qtx{+j9Gkswq7RJ1GB0NhwbBPy5fw9Ukiw3*zk6&^DoMOyt4%Z{p|`_-~Q8%?@>2hJ8f^vKdt({ zlD-LsA-LKx&yXy6>%@=)JHs?hBeaYi`B_>SypI-~T z{c&~b^}COG{xAAB|HJ>af4(2B-SzLd_GiX_@~i)c;)VEU>C!Q?zna$YqYT4=Yj|%K_U*5WT^X{VDyji<$ZN9<$?BdV)b1V6nUo5|& zD=W#;FtzI6nMAQ@bLYA%TcWnzy7p{;%I@0Jj%V8}Tb_oc?6+##UT?`bx70dvZpP)T z<^CV8KMel!_0=@q)Bj%aym~CA`Z&5$V$IvgD(&hYW$%3#r2lbdw?435`QFv~`W03D zJtZIc^R9hZU2w0rJsY7v(GPm z>8)9I_Hn?!-{&m8Z8Q4cuz&Z4U#t@y?D>C8|6U(9!};I*Px`O^bN=7_=RCj7>WtWw z%QL^fsy}g5{RjV*`nP9yeSg`P_c=%{Dt%65_~tw2?f>%g>%}XA-!GkaTx`RG?WNn+ z%=^kM^WghS`G@-B?H|qZ2Ua)PFP$Runt%T%)0^VA8q|TAfWgz% K&t;ucLK6V?!m + + + + + +HIP: Heterogenous-computing Interface for Portability: Member List + + + + + + + + + +
+
+ + + + + + +
+
HIP: Heterogenous-computing Interface for Portability +
+
+
+ + + + + + + + + +
+ +
+ +
+
+
+
ihipStream_t Member List
+
+
+ +

This is the complete list of members for ihipStream_t, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + +
_av (defined in ihipStream_t)ihipStream_t
_flags (defined in ihipStream_t)ihipStream_t
_id (defined in ihipStream_t)ihipStream_t
allocSignal(LockedAccessor_StreamCrit_t &crit) (defined in ihipStream_t)ihipStream_t
copyAsync(void *dst, const void *src, size_t sizeBytes, unsigned kind) (defined in ihipStream_t)ihipStream_t
copySync(LockedAccessor_StreamCrit_t &crit, void *dst, const void *src, size_t sizeBytes, unsigned kind) (defined in ihipStream_t)ihipStream_t
getDevice() const (defined in ihipStream_t)ihipStream_t
ihipStream_t(unsigned device_index, hc::accelerator_view av, unsigned int flags) (defined in ihipStream_t)ihipStream_t
lastCopySeqId(LockedAccessor_StreamCrit_t &crit) (defined in ihipStream_t)ihipStream_tinline
lockclose_postKernelCommand(hc::completion_future &kernel_future) (defined in ihipStream_t)ihipStream_t
locked_copySync(void *dst, const void *src, size_t sizeBytes, unsigned kind) (defined in ihipStream_t)ihipStream_t
locked_lastCopySeqId() (defined in ihipStream_t)ihipStream_tinline
locked_reclaimSignals(SIGSEQNUM sigNum) (defined in ihipStream_t)ihipStream_t
locked_wait(bool assertQueueEmpty=false) (defined in ihipStream_t)ihipStream_t
lockopen_preKernelCommand() (defined in ihipStream_t)ihipStream_t
operator<< (defined in ihipStream_t)ihipStream_tfriend
preCopyCommand(LockedAccessor_StreamCrit_t &crit, ihipSignal_t *lastCopy, hsa_signal_t *waitSignal, ihipCommand_t copyType) (defined in ihipStream_t)ihipStream_t
SeqNum_t typedef (defined in ihipStream_t)ihipStream_t
wait(LockedAccessor_StreamCrit_t &crit, bool assertQueueEmpty=false) (defined in ihipStream_t)ihipStream_t
~ihipStream_t() (defined in ihipStream_t)ihipStream_t
+ + + + diff --git a/docs/RuntimeAPI/html/classihipStream__t.html b/docs/RuntimeAPI/html/classihipStream__t.html new file mode 100644 index 0000000000..3c101e9bc0 --- /dev/null +++ b/docs/RuntimeAPI/html/classihipStream__t.html @@ -0,0 +1,178 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: ihipStream_t Class Reference + + + + + + + + + +
+
+ + + + + + +
+
HIP: Heterogenous-computing Interface for Portability +
+
+
+ + + + + + + + + +
+ +
+ +
+
+ +
+
ihipStream_t Class Reference
+
+
+ + + + +

+Public Types

+typedef uint64_t SeqNum_t
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

ihipStream_t (unsigned device_index, hc::accelerator_view av, unsigned int flags)
 
+void copySync (LockedAccessor_StreamCrit_t &crit, void *dst, const void *src, size_t sizeBytes, unsigned kind)
 
+void locked_copySync (void *dst, const void *src, size_t sizeBytes, unsigned kind)
 
+void copyAsync (void *dst, const void *src, size_t sizeBytes, unsigned kind)
 
+bool lockopen_preKernelCommand ()
 
+void lockclose_postKernelCommand (hc::completion_future &kernel_future)
 
+int preCopyCommand (LockedAccessor_StreamCrit_t &crit, ihipSignal_t *lastCopy, hsa_signal_t *waitSignal, ihipCommand_t copyType)
 
+void locked_reclaimSignals (SIGSEQNUM sigNum)
 
+void locked_wait (bool assertQueueEmpty=false)
 
+SIGSEQNUM locked_lastCopySeqId ()
 
+void wait (LockedAccessor_StreamCrit_t &crit, bool assertQueueEmpty=false)
 
+SIGSEQNUM lastCopySeqId (LockedAccessor_StreamCrit_t &crit)
 
+ihipSignal_tallocSignal (LockedAccessor_StreamCrit_t &crit)
 
+ihipDevice_tgetDevice () const
 
+ + + + + + + +

+Public Attributes

+SeqNum_t _id
 
+hc::accelerator_view _av
 
+unsigned _flags
 
+ + + +

+Friends

+std::ostream & operator<< (std::ostream &os, const ihipStream_t &s)
 
+
The documentation for this class was generated from the following files:
    +
  • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
  • +
  • /home/mangupta/hip_git/rel0.84.0/src/hip_hcc.cpp
  • +
+
+ + + + diff --git a/docs/RuntimeAPI/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/RuntimeAPI/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html index 71b55290ce..8ea47d84d0 100644 --- a/docs/RuntimeAPI/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/docs/RuntimeAPI/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/src Directory Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/src Directory Reference @@ -86,9 +86,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); + + + + + + + + - + + + + + @@ -96,7 +108,7 @@ Files diff --git a/docs/RuntimeAPI/html/dir_6d8604cb65fa6b83549668eb0ce09cac.html b/docs/RuntimeAPI/html/dir_6d8604cb65fa6b83549668eb0ce09cac.html index 32a8932ad9..818899bc59 100644 --- a/docs/RuntimeAPI/html/dir_6d8604cb65fa6b83549668eb0ce09cac.html +++ b/docs/RuntimeAPI/html/dir_6d8604cb65fa6b83549668eb0ce09cac.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail Directory Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail Directory Reference @@ -86,6 +86,10 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

Files

file  device_util.cpp
 
file  hip_device.cpp
 
file  hip_error.cpp
 
file  hip_event.cpp
 
file  hip_hcc.cpp
 
file  hip_hcc2.cpp
file  hip_memory.cpp
 
file  hip_peer.cpp
 
file  hip_stream.cpp
 
file  staging_buffer.cpp
 
+ + + + @@ -95,6 +99,8 @@ Files + + @@ -109,7 +115,7 @@ Files diff --git a/docs/RuntimeAPI/html/dir_d44c64559bbebec7f509842c48db8b23.html b/docs/RuntimeAPI/html/dir_d44c64559bbebec7f509842c48db8b23.html index 1eaa18e079..7a9bf94f64 100644 --- a/docs/RuntimeAPI/html/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/docs/RuntimeAPI/html/dir_d44c64559bbebec7f509842c48db8b23.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include Directory Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include Directory Reference @@ -91,6 +91,8 @@ Directories

Files

file  hcc_acc.h [code]
 
file  hip_hcc.h [code]
 
file  hip_runtime.h [code]
 Contains definitions of APIs for HIP runtime.
 
file  hip_texture.h [code]
 HIP C++ Texture API for hcc compiler.
 
file  hip_util.h [code]
 
file  hip_vector_types.h [code]
 Defines the different newt vector types for HIP runtime.
 
+ + @@ -103,7 +105,7 @@ Files diff --git a/docs/RuntimeAPI/html/files.html b/docs/RuntimeAPI/html/files.html index 0e4f7bba8b..9c4227fd9d 100644 --- a/docs/RuntimeAPI/html/files.html +++ b/docs/RuntimeAPI/html/files.html @@ -89,17 +89,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
[detail level 123]

Files

file  hcc.h [code]
 
file  hip_common.h [code]
 
file  hip_runtime.h [code]
- - - - - - - - - - - + + + + + + + + + + + + + + +
o-include
|o-hcc_detail
||o*hip_runtime.hContains definitions of APIs for HIP runtime
||o*hip_runtime_api.hContains C function APIs for HIP runtime. This file does not use any HCC builtin or special language extensions (-hc mode) ; those functions in hip_runtime.h
||o*hip_texture.hHIP C++ Texture API for hcc compiler
||o*hip_vector_types.hDefines the different newt vector types for HIP runtime
||o*host_defines.hTODO-doc
||o*staging_buffer.h
||\*trace_helper.h
|o*hip_common.h
|o*hip_runtime.h
|o*hip_runtime_api.h
|\*hip_vector_types.h
||o*hcc_acc.h
||o*hip_hcc.h
||o*hip_runtime.hContains definitions of APIs for HIP runtime
||o*hip_runtime_api.hContains C function APIs for HIP runtime. This file does not use any HCC builtin or special language extensions (-hc mode) ; those functions in hip_runtime.h
||o*hip_texture.hHIP C++ Texture API for hcc compiler
||o*hip_util.h
||o*hip_vector_types.hDefines the different newt vector types for HIP runtime
||o*host_defines.hTODO-doc
||o*staging_buffer.h
||\*trace_helper.h
|o*hcc.h
|o*hip_common.h
|o*hip_runtime.h
|o*hip_runtime_api.h
|\*hip_vector_types.h
\-src
 \*hip_hcc.cpp
@@ -107,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/functions.html b/docs/RuntimeAPI/html/functions.html index e6a4e60528..2eabb218cc 100644 --- a/docs/RuntimeAPI/html/functions.html +++ b/docs/RuntimeAPI/html/functions.html @@ -70,7 +70,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); @@ -78,7 +77,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • a
  • c
  • -
  • g
  • h
  • i
  • l
  • @@ -138,13 +136,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-

- g -

- -

- h -

  • has3dGrid : hipDeviceArch_t @@ -318,7 +309,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/functions_vars.html b/docs/RuntimeAPI/html/functions_vars.html index a000c0d646..5dc919231f 100644 --- a/docs/RuntimeAPI/html/functions_vars.html +++ b/docs/RuntimeAPI/html/functions_vars.html @@ -70,7 +70,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); @@ -310,7 +309,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals.html b/docs/RuntimeAPI/html/globals.html index bc41f5d7cc..1e1f48fee6 100644 --- a/docs/RuntimeAPI/html/globals.html +++ b/docs/RuntimeAPI/html/globals.html @@ -69,7 +69,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    • All
    • Functions
    • -
    • Variables
    • Typedefs
    • Enumerations
    • Enumerator
    • @@ -117,108 +116,80 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

      - h -

        -
      • HIP_LAUNCH_BLOCKING -: hip_runtime.h -, hip_hcc.cpp -
      • -
      • HIP_PRINT_ENV -: hip_runtime.h -, hip_hcc.cpp -
      • -
      • HIP_TRACE_API -: hip_runtime.h -, hip_hcc.cpp -
      • hipDeviceCanAccessPeer() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_runtime_api.h
      • hipDeviceDisablePeerAccess() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_runtime_api.h
      • hipDeviceEnablePeerAccess() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_runtime_api.h
      • hipDeviceGetAttribute() : hip_runtime_api.h -, hip_hcc.cpp
      • hipDeviceGetCacheConfig() : hip_runtime_api.h -, hip_hcc.cpp
      • hipDeviceGetSharedMemConfig() : hip_runtime_api.h -, hip_hcc.cpp
      • hipDeviceReset() : hip_runtime_api.h -, hip_hcc.cpp
      • hipDeviceSetCacheConfig() : hip_runtime_api.h -, hip_hcc.cpp
      • hipDeviceSetSharedMemConfig() : hip_runtime_api.h -, hip_hcc.cpp
      • hipDeviceSynchronize() : hip_runtime_api.h -, hip_hcc.cpp
      • hipDriverGetVersion() : hip_runtime_api.h -, hip_hcc.cpp
      • hipEventBlockingSync : hip_runtime_api.h
      • +
      • hipEventCreate() +: hip_runtime_api.h +
      • hipEventCreateWithFlags() : hip_runtime_api.h -, hip_hcc.cpp
      • hipEventDefault : hip_runtime_api.h
      • hipEventDestroy() : hip_runtime_api.h -, hip_hcc.cpp
      • hipEventDisableTiming : hip_runtime_api.h
      • hipEventElapsedTime() : hip_runtime_api.h -, hip_hcc.cpp
      • hipEventInterprocess : hip_runtime_api.h
      • hipEventQuery() : hip_runtime_api.h -, hip_hcc.cpp
      • hipEventRecord() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_runtime_api.h
      • hipEventSynchronize() : hip_runtime_api.h -, hip_hcc.cpp
      • hipFilterModePoint : hip_texture.h
      • hipFree() : hip_runtime_api.h -, hip_hcc.cpp
      • hipFreeHost() : hip_runtime_api.h -, hip_hcc.cpp
      • hipFuncCache : hip_runtime_api.h @@ -237,62 +208,48 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
      • hipFuncSetCacheConfig() : hip_runtime_api.h -, hip_hcc.cpp
      • hipGetDevice() : hip_runtime_api.h -, hip_hcc.cpp
      • hipGetDeviceCount() : hip_runtime_api.h -, hip_hcc.cpp
      • hipGetDeviceProperties() : hip_runtime_api.h -, hip_hcc.cpp
      • hipGetErrorName() : hip_runtime_api.h -, hip_hcc.cpp
      • hipGetErrorString() : hip_runtime_api.h -, hip_hcc.cpp
      • hipGetLastError() : hip_runtime_api.h -, hip_hcc.cpp
      • hipHccGetAccelerator() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_hcc.cpp
      • hipHccGetAcceleratorView() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_hcc.cpp
      • hipHostFree() : hip_runtime_api.h -, hip_hcc.cpp
      • hipHostGetDevicePointer() : hip_runtime_api.h -, hip_hcc.cpp
      • hipHostGetFlags() : hip_runtime_api.h -, hip_hcc.cpp
      • hipHostMalloc() : hip_runtime_api.h -, hip_hcc.cpp
      • hipHostMallocDefault : hip_runtime_api.h
      • hipHostRegister() : hip_runtime_api.h -, hip_hcc.cpp
      • hipHostRegisterDefault : hip_runtime_api.h @@ -308,23 +265,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
      • hipHostUnregister() : hip_runtime_api.h -, hip_hcc.cpp
      • hipMalloc() : hip_runtime_api.h -, hip_hcc.cpp
      • hipMallocHost() : hip_runtime_api.h -, hip_hcc.cpp
      • hipMemcpy() : hip_runtime_api.h -, hip_hcc.cpp
      • hipMemcpyAsync() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_runtime_api.h
      • hipMemcpyDefault : hip_runtime_api.h @@ -345,42 +297,37 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : hip_runtime_api.h
      • hipMemcpyPeer() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_runtime_api.h
      • hipMemcpyPeerAsync() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_runtime_api.h
      • hipMemcpyToSymbol() : hip_runtime_api.h -, hip_hcc.cpp
      • hipMemGetInfo() : hip_runtime_api.h -, hip_hcc.cpp
      • hipMemset() : hip_runtime_api.h -, hip_hcc.cpp
      • hipMemsetAsync() -: hip_runtime_api.h -, hip_hcc.cpp +: hip_runtime_api.h
      • hipPeekAtLastError() : hip_runtime_api.h
      • hipPointerGetAttributes() : hip_runtime_api.h -, hip_hcc.cpp
      • hipReadModeElementType : hip_texture.h
      • hipSetDevice() : hip_runtime_api.h -, hip_hcc.cpp +
      • +
      • hipSetDeviceFlags() +: hip_runtime_api.h
      • hipSharedMemBankSizeDefault : hip_runtime_api.h @@ -394,31 +341,29 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
      • hipSharedMemConfig : hip_runtime_api.h
      • +
      • hipStreamCreate() +: hip_runtime_api.h +
      • hipStreamCreateWithFlags() : hip_runtime_api.h -, hip_hcc.cpp
      • hipStreamDefault : hip_runtime_api.h
      • hipStreamDestroy() : hip_runtime_api.h -, hip_hcc.cpp
      • hipStreamGetFlags() : hip_runtime_api.h -, hip_hcc.cpp
      • hipStreamNonBlocking : hip_runtime_api.h
      • hipStreamSynchronize() : hip_runtime_api.h -, hip_hcc.cpp
      • hipStreamWaitEvent() : hip_runtime_api.h -, hip_hcc.cpp
      • hipTextureFilterMode : hip_texture.h @@ -440,7 +385,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals_defs.html b/docs/RuntimeAPI/html/globals_defs.html index 43666cc30a..c98e741616 100644 --- a/docs/RuntimeAPI/html/globals_defs.html +++ b/docs/RuntimeAPI/html/globals_defs.html @@ -69,7 +69,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
        • All
        • Functions
        • -
        • Variables
        • Typedefs
        • Enumerations
        • Enumerator
        • @@ -139,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals_enum.html b/docs/RuntimeAPI/html/globals_enum.html index e8a736e97d..21ee1800ad 100644 --- a/docs/RuntimeAPI/html/globals_enum.html +++ b/docs/RuntimeAPI/html/globals_enum.html @@ -69,7 +69,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
          • All
          • Functions
          • -
          • Variables
          • Typedefs
          • Enumerations
          • Enumerator
          • @@ -112,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals_eval.html b/docs/RuntimeAPI/html/globals_eval.html index d4c28a5457..8c8143077d 100644 --- a/docs/RuntimeAPI/html/globals_eval.html +++ b/docs/RuntimeAPI/html/globals_eval.html @@ -69,7 +69,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
            • All
            • Functions
            • -
            • Variables
            • Typedefs
            • Enumerations
            • Enumerator
            • @@ -139,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals_func.html b/docs/RuntimeAPI/html/globals_func.html index a61e5f84a9..66b5ca15dd 100644 --- a/docs/RuntimeAPI/html/globals_func.html +++ b/docs/RuntimeAPI/html/globals_func.html @@ -69,7 +69,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
              • All
              • Functions
              • -
              • Variables
              • Typedefs
              • Enumerations
              • Enumerator
              • @@ -101,217 +100,175 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

                - h -

                diff --git a/docs/RuntimeAPI/html/globals_type.html b/docs/RuntimeAPI/html/globals_type.html index 0310e6ead0..7730e8d003 100644 --- a/docs/RuntimeAPI/html/globals_type.html +++ b/docs/RuntimeAPI/html/globals_type.html @@ -69,7 +69,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                • All
                • Functions
                • -
                • Variables
                • Typedefs
                • Enumerations
                • Enumerator
                • @@ -99,6 +98,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                • hipFuncCache : hip_runtime_api.h
                • +
                • hipMemcpyKind +: hip_runtime_api.h +
                • hipSharedMemConfig : hip_runtime_api.h
                • @@ -106,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/group__API.html b/docs/RuntimeAPI/html/group__API.html index f26e9091d5..167a738125 100644 --- a/docs/RuntimeAPI/html/group__API.html +++ b/docs/RuntimeAPI/html/group__API.html @@ -110,7 +110,7 @@ Modules diff --git a/docs/RuntimeAPI/html/group__Device.html b/docs/RuntimeAPI/html/group__Device.html index 3332a36137..c03607d6ed 100644 --- a/docs/RuntimeAPI/html/group__Device.html +++ b/docs/RuntimeAPI/html/group__Device.html @@ -120,6 +120,9 @@ Functions hipError_t hipDeviceSetSharedMemConfig (hipSharedMemConfig config)  Set Shared memory bank configuration. More...
                    +hipError_t hipSetDeviceFlags (unsigned flags) + Set Device flags. More...

                  Detailed Description

                  ----------------------------------------------------------------------------------------------—

                  @@ -396,12 +399,7 @@ Functions

                  Populates hipGetDeviceProperties with information for the specified device.

                  Returns
                  hipSuccess, hipErrorInvalidDevice
                  -
                  Bug:

                  HCC always returns 0 for maxThreadsPerMultiProcessor

                  -

                  HCC always returns 0 for regsPerBlock

                  -

                  HCC always returns 0 for l2CacheSize

                  -
                  -
                  Returns
                  hipSuccess, hipErrorInvalidDevice
                  -
                  Bug:

                  HCC always returns 0 for maxThreadsPerMultiProcessor

                  +
                  Bug:

                  HCC always returns 0 for maxThreadsPerMultiProcessor

                  HCC always returns 0 for regsPerBlock

                  HCC always returns 0 for l2CacheSize

                  @@ -441,12 +439,31 @@ Functions
                  See Also
                  hipGetDevice, hipGetDeviceCount
                  Returns
                  hipSuccess, hipErrorInvalidDevice
                  + + + +
                  +
                  + + + + + + + + +
                  hipError_t hipSetDeviceFlags (unsigned flags)
                  +
                  + +

                  Set Device flags.

                  +

                  Note: Only hipDeviceScheduleAuto and hipDeviceMapHost are supported

                  +
                  diff --git a/docs/RuntimeAPI/html/group__Enumerations.html b/docs/RuntimeAPI/html/group__Enumerations.html deleted file mode 100644 index 9813d08bc5..0000000000 --- a/docs/RuntimeAPI/html/group__Enumerations.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Global enumeration types - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - -
                  - - - - -
                  - -
                  - -
                  - -
                  -
                  Global enumeration types
                  -
                  -
                  - - - - -

                  -Typedefs

                  -typedef enum hipError_t hipError_t
                   
                  - - - -

                  -Enumerations

                  enum  hipError_t {
                  -  hipSuccess = 0, -hipErrorMemoryAllocation, -hipErrorMemoryFree, -hipErrorUnknownSymbol, -
                  -  hipErrorOutOfResources, -hipErrorInvalidValue, -hipErrorInvalidResourceHandle, -hipErrorInvalidDevice, -
                  -  hipErrorNoDevice, -hipErrorNotReady, -hipErrorUnknown, -hipErrorTbd -
                  - }
                   
                  -

                  Detailed Description

                  -

                  Enumeration Type Documentation

                  - -
                  -
                  - - - - -
                  enum hipError_t
                  -
                  - - - - - - - - - - - - - -
                  Enumerator
                  hipSuccess  -

                  No error.

                  -
                  hipErrorMemoryAllocation  -

                  Memory allocation error.

                  -
                  hipErrorMemoryFree  -

                  Memory free error.

                  -
                  hipErrorUnknownSymbol  -

                  Unknown symbol.

                  -
                  hipErrorOutOfResources  -

                  Out of resources error.

                  -
                  hipErrorInvalidValue  -

                  One or more of the paramters passed to the API call is NULL or not in an acceptable range.

                  -
                  hipErrorInvalidResourceHandle  -

                  Resource handle (hipEvent_t or hipStream_t) invalid.

                  -
                  hipErrorInvalidDevice  -

                  DeviceID must be in range 0...#compute-devices.

                  -
                  hipErrorNoDevice  -

                  Call to cudaGetDeviceCount returned 0 devices.

                  -
                  hipErrorNotReady  -

                  indicates that asynchronous operations enqueued earlier are not ready. This is not actually an error, but is used to distinguish from hipSuccess (which indicates completion). APIs that return this error include hipEventQuery and hipStreamQuery.

                  -
                  hipErrorUnknown  -

                  Unknown error.

                  -
                  hipErrorTbd  -

                  Marker that more error codes are needed.

                  -
                  - -
                  -
                  -
                  - - - - diff --git a/docs/RuntimeAPI/html/group__Error.html b/docs/RuntimeAPI/html/group__Error.html index 1855472492..e877b2624f 100644 --- a/docs/RuntimeAPI/html/group__Error.html +++ b/docs/RuntimeAPI/html/group__Error.html @@ -197,7 +197,7 @@ Functions diff --git a/docs/RuntimeAPI/html/group__Event.html b/docs/RuntimeAPI/html/group__Event.html index 3a2ff62eb2..c9756da0e4 100644 --- a/docs/RuntimeAPI/html/group__Event.html +++ b/docs/RuntimeAPI/html/group__Event.html @@ -87,9 +87,11 @@ Functions hipError_t hipEventCreateWithFlags (hipEvent_t *event, unsigned flags)  Create an event with the specified flags. More...
                    -hipError_t hipEventRecord (hipEvent_t event, hipStream_t stream=NULL) - Record an event in the specified stream. More...
                  -  +hipError_t hipEventCreate (hipEvent_t *event) +  +hipError_t hipEventRecord (hipEvent_t event, hipStream_t stream) + Record an event in the specified stream. More...
                  hipError_t hipEventDestroy (hipEvent_t event)  Destroy the specified event. More...
                    @@ -106,6 +108,29 @@ Functions

                  Detailed Description

                  ----------------------------------------------------------------------------------------------—

                  Function Documentation

                  + +
                  +
                  + + + + + + + + +
                  hipError_t hipEventCreate (hipEvent_tevent)
                  +
                  +

                  Create an event

                  +
                  Parameters
                  + + +
                  [in,out]eventReturns the newly created event.
                  +
                  +
                  + +
                  +
                  @@ -243,7 +268,7 @@ Functions
                  - +
                  @@ -257,7 +282,7 @@ Functions - + @@ -315,7 +340,7 @@ Functions diff --git a/docs/RuntimeAPI/html/group__GlobalDefs.html b/docs/RuntimeAPI/html/group__GlobalDefs.html index b39c89dee4..dd2c898093 100644 --- a/docs/RuntimeAPI/html/group__GlobalDefs.html +++ b/docs/RuntimeAPI/html/group__GlobalDefs.html @@ -141,6 +141,24 @@ Macros #define  + + + + + + + + + + + +
                  hipStream_t stream = NULL stream 
                  hipHostRegisterIoMemory   0x4
                   Not supported.
                   
                  +#define hipDeviceScheduleAuto   0x0
                   
                  +#define hipDeviceScheduleSpin   0x1
                   
                  +#define hipDeviceScheduleYield   0x2
                   
                  +#define hipDeviceBlockingSync   0x4
                   
                  +#define hipDeviceMapHost   0x8
                   
                  +#define hipDeviceLmemResizeToMax   0x16
                   
                  @@ -156,6 +174,8 @@ typedef enum + +

                  Typedefs

                   
                  typedef struct dim3 dim3
                   
                  typedef enum hipMemcpyKind hipMemcpyKind
                   
                  @@ -177,10 +197,12 @@ Enumerations
                    
                  hipErrorNotReady, hipErrorUnknown, -hipErrorRuntimeMemory, -hipErrorRuntimeOther, +hipErrorPeerAccessNotEnabled, +hipErrorPeerAccessAlreadyEnabled,
                  -  hipErrorTbd +  hipErrorRuntimeMemory, +hipErrorRuntimeOther, +hipErrorTbd
                  } @@ -299,7 +321,7 @@ Enumerations

                  Flags that can be used with hipStreamCreateWithFlags.

                  -

                  Default stream creation flags. These are used with hipStreamCreate().

                  +

                  Default stream creation flags. These are used with hipStreamCreate().

                  @@ -328,6 +350,19 @@ Enumerations
                  Warning
                  On AMD devices and recent Nvidia devices, these hints and controls are ignored.
                  +
                  + + +
                  +
                  +

                  Enumerations

                   
                  + + + +
                  typedef enum hipMemcpyKind hipMemcpyKind
                  +
                  +

                  Memory copy types

                  +
                  @@ -485,6 +520,12 @@ Enumerations hipErrorUnknown 

                  Unknown error.

                  +hipErrorPeerAccessNotEnabled  +

                  Peer access was never enabled from the current device.

                  + +hipErrorPeerAccessAlreadyEnabled  +

                  Peer access was already enabled from the current device.

                  + hipErrorRuntimeMemory 

                  HSA runtime memory call returned error. Typically not seen in production systems.

                  @@ -582,7 +623,7 @@ Enumerations diff --git a/docs/RuntimeAPI/html/group__HCC-Specific.html b/docs/RuntimeAPI/html/group__HCC-Specific.html deleted file mode 100644 index df8399d027..0000000000 --- a/docs/RuntimeAPI/html/group__HCC-Specific.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Accessors - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - -
                  - - - - -
                  - -
                  - -
                  -
                  -
                  Accessors
                  -
                  -
                  -

                  ----------------------------------------------------------------------------------------------—

                  -

                  The following calls are only supported when compiler HIP with HCC. To produce portable code, use of these calls must be guarded #ifdef checks:

                  -
                  #ifdef __HCC__
                  -
                  hc::accelerator acc;
                  -
                  hipError_t err = hipHccGetAccelerator(deviceId, &acc)
                  -
                  #endif
                  -
                  - - - - diff --git a/docs/RuntimeAPI/html/group__HCC__Specific.html b/docs/RuntimeAPI/html/group__HCC__Specific.html index 7096290cc1..5ea57f348f 100644 --- a/docs/RuntimeAPI/html/group__HCC__Specific.html +++ b/docs/RuntimeAPI/html/group__HCC__Specific.html @@ -75,92 +75,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  -
                  HCC-Specific Accessors
                  - - - - - - - - -

                  -Functions

                  hipError_t hipHccGetAccelerator (int deviceId, hc::accelerator *acc)
                   Return hc::accelerator associated with the specified deviceId. More...
                   
                  hipError_t hipHccGetAcceleratorView (hipStream_t stream, hc::accelerator_view **av)
                   Return hc::accelerator_view associated with the specified stream. More...
                   
                  -

                  Detailed Description

                  ----------------------------------------------------------------------------------------------—

                  The following calls are only supported when compiler HIP with HCC. To produce portable code, use of these calls must be guarded #ifdef checks:

                  #ifdef __HCC__
                  hc::accelerator acc;
                  -
                  hipError_t err = hipHccGetAccelerator(deviceId, &acc)
                  +
                  hipError_t err = hipHccGetAccelerator(deviceId, &acc)
                  #endif
                  -

                  Function Documentation

                  - -
                  -
                  - - - - - - - - - - - - - - - - - - -
                  hipError_t hipHccGetAccelerator (int deviceId,
                  hc::accelerator * acc 
                  )
                  -
                  - -

                  Return hc::accelerator associated with the specified deviceId.

                  -
                  Returns
                  hipSuccess, hipErrorInvalidDevice
                  - -
                  -
                  - -
                  -
                  - - - - - - - - - - - - - - - - - - -
                  hipError_t hipHccGetAcceleratorView (hipStream_t stream,
                  hc::accelerator_view ** av 
                  )
                  -
                  - -

                  Return hc::accelerator_view associated with the specified stream.

                  -
                  Returns
                  hipSuccess
                  - -
                  -
                  -
                  + diff --git a/docs/RuntimeAPI/html/group__HIP-ENV.html b/docs/RuntimeAPI/html/group__HIP-ENV.html index 50e713459f..dacfb02ec3 100644 --- a/docs/RuntimeAPI/html/group__HIP-ENV.html +++ b/docs/RuntimeAPI/html/group__HIP-ENV.html @@ -75,33 +75,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  -
                  HIP Environment Variables
                  - - - - - - - - - - - -

                  -Variables

                  -int HIP_PRINT_ENV
                   Print all HIP-related environment variables.
                   
                  -int HIP_TRACE_API
                   Trace HIP APIs.
                   
                  -int HIP_LAUNCH_BLOCKING
                   Make all HIP APIs host-synchronous.
                   
                  -

                  Detailed Description

                  diff --git a/docs/RuntimeAPI/html/group__Memory.html b/docs/RuntimeAPI/html/group__Memory.html index 1e2f0e1093..85d0a0390f 100644 --- a/docs/RuntimeAPI/html/group__Memory.html +++ b/docs/RuntimeAPI/html/group__Memory.html @@ -126,15 +126,15 @@ Functions hipError_t hipMemcpyToSymbol (const char *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind)  Copies sizeBytes bytes from the memory area pointed to by src to the memory area pointed to by offset bytes from the start of symbol symbol. More...
                    -hipError_t hipMemcpyAsync (void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream=0) - Copy data from src to dst asynchronously. More...
                  -  +hipError_t hipMemcpyAsync (void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream) + Copy data from src to dst asynchronously. More...
                  hipError_t hipMemset (void *dst, int value, size_t sizeBytes)  Copy data from src to dst asynchronously. More...
                    -hipError_t hipMemsetAsync (void *dst, int value, size_t sizeBytes, hipStream_t=0) - Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value value. More...
                  -  +hipError_t hipMemsetAsync (void *dst, int value, size_t sizeBytes, hipStream_t stream) + Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value value. More...
                  hipError_t hipMemGetInfo (size_t *free, size_t *total)  Query memory info. Return snapshot of free memory, and total allocatable memory on the device. More...
                    @@ -548,7 +548,7 @@ Functions - +
                  @@ -608,10 +608,6 @@ FunctionshipErrorInvalidValue : If dst==NULL or src==NULL, or other bad argument.
                  Warning
                  on HCC hipMemcpyAsync does not support overlapped H2D and D2H copies.
                  -on HCC hipMemcpyAsync requires that any host pointers are pinned (ie via the hipMallocHost call).
                  -
                  Returns
                  hipSuccess, hipErrorInvalidDevice, hipErrorInvalidMemcpyDirection, hipErrorInvalidValue
                  -
                  Warning
                  on HCC hipMemcpyAsync does not support overlapped H2D and D2H copies.
                  -
                  on HCC hipMemcpyAsync requires that any host pointers are pinned (ie via the hipMallocHost call).
                  @@ -748,7 +744,7 @@ on HCC hipMemcpyAsync requires that any host pointers are pinned (ie via the hip - +
                  @@ -785,7 +781,7 @@ on HCC hipMemcpyAsync requires that any host pointers are pinned (ie via the hip

                  Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value value.

                  -

                  hipMemsetAsync() is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero stream argument. If stream is non-zero, the operation may overlap with operations in other streams.

                  +

                  hipMemsetAsync() is asynchronous with respect to the host, so the call may return before the memset is complete. The operation can optionally be associated to a stream by passing a non-zero stream argument. If stream is non-zero, the operation may overlap with operations in other streams.

                  Parameters
                  @@ -833,7 +829,7 @@ on HCC hipMemcpyAsync requires that any host pointers are pinned (ie via the hip diff --git a/docs/RuntimeAPI/html/group__PeerToPeer.html b/docs/RuntimeAPI/html/group__PeerToPeer.html index befc6829cf..68e2c12d3e 100644 --- a/docs/RuntimeAPI/html/group__PeerToPeer.html +++ b/docs/RuntimeAPI/html/group__PeerToPeer.html @@ -84,26 +84,26 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  [out]dstPointer to device memory
                  - - - - - - - - - - - - - - - + + + + + + + + + + + + + + +

                  Functions

                  hipError_t hipDeviceCanAccessPeer (int *canAccessPeer, int device, int peerDevice)
                   Determine if a device can access a peer's memory. More...
                   
                  hipError_t hipDeviceDisablePeerAccess (int peerDevice)
                   Disables registering memory on peerDevice for direct access from the current device. More...
                   
                  hipError_t hipDeviceEnablePeerAccess (int peerDevice, unsigned int flags)
                   Enables registering memory on peerDevice for direct access from the current device. More...
                   
                  hipError_t hipMemcpyPeer (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes)
                   Copies memory from one device to memory on another device. More...
                   
                  hipError_t hipMemcpyPeerAsync (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream=0)
                   Copies memory from one device to memory on another device. More...
                   
                  hipError_t hipDeviceCanAccessPeer (int *canAccessPeer, int deviceId, int peerDeviceId)
                   Determine if a device can access a peer's memory. More...
                   
                  hipError_t hipDeviceEnablePeerAccess (int peerDeviceId, unsigned int flags)
                   Enable direct access from current device's virtual address space to memory allocations physically located on a peer device. More...
                   
                  hipError_t hipDeviceDisablePeerAccess (int peerDeviceId)
                   Disable direct access from current device's virtual address space to memory allocations physically located on a peer device. More...
                   
                  hipError_t hipMemcpyPeer (void *dst, int dstDeviceId, const void *src, int srcDeviceId, size_t sizeBytes)
                   Copies memory from one device to memory on another device. More...
                   
                  hipError_t hipMemcpyPeerAsync (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream)
                   Copies memory from one device to memory on another device. More...
                   

                  Detailed Description

                  ----------------------------------------------------------------------------------------------—

                  Function Documentation

                  - +
                  @@ -117,13 +117,13 @@ Functions - + - + @@ -142,11 +142,15 @@ Functions
                  int device, deviceId,
                  int peerDevice peerDeviceId 
                  +

                  Returns "0" in canAccessPeer if deviceId == peerDeviceId, and both are valid devices : a device is not a peer of itself.

                  +
                  Returns
                  hipSuccess,
                  +
                  +hipErrorInvalidDevice if deviceId or peerDeviceId are not valid devices
                  Warning
                  HCC returns 0 in *canAccessPeer ; Need to update this function when RT supports P2P
                  - +
                  @@ -154,25 +158,24 @@ Functions - +
                  hipError_t hipDeviceDisablePeerAccess ( int peerDevice)peerDeviceId)
                  -

                  Disables registering memory on peerDevice for direct access from the current device.

                  -

                  If there are any allocations on peerDevice which were registered in the current device using hipPeerRegister() then these allocations will be automatically unregistered. Returns hipErrorPeerAccessNotEnabled if direct access to memory on peerDevice has not yet been enabled from the current device.

                  +

                  Disable direct access from current device's virtual address space to memory allocations physically located on a peer device.

                  +

                  Returns hipErrorPeerAccessNotEnabled if direct access to memory on peerDevice has not yet been enabled from the current device.

                  Parameters
                  - +
                  [in]peerDeviceTODO:cudaErrorPeerAccessNotEnabled and cudaErrorInvalidDevice error not supported in HIP, return hipErrorUnknown Returns hipSuccess, hipErrorUnknown
                  [in]peerDeviceIdReturns hipSuccess, hipErrorPeerAccessNotEnabled
                  -
                  Warning
                  Need to update this function when RT supports P2P
                  - +
                  @@ -180,7 +183,7 @@ Functions - + @@ -196,19 +199,20 @@ Functions
                  hipError_t hipDeviceEnablePeerAccess ( int peerDevice, peerDeviceId,
                  -

                  Enables registering memory on peerDevice for direct access from the current device.

                  +

                  Enable direct access from current device's virtual address space to memory allocations physically located on a peer device.

                  +

                  Memory which already allocated on peer device will be mapped into the address space of the current device. In addition, all future memory allocations on peerDeviceId will be mapped into the address space of the current device when the memory is allocated. The peer memory remains accessible from the current device until a call to hipDeviceDisablePeerAccess or hipDeviceReset.

                  Parameters
                  - - + +
                  [in]peerDevice
                  [in]flagsTODO:cudaErrorInvalidDevice error not supported in HIP, return hipErrorUnknown Returns hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue, hipErrorUnknown
                  [in]peerDeviceId
                  [in]flagsReturns hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue,
                  -
                  Warning
                  Need to update this function when RT supports P2P
                  +
                  Returns
                  hipErrorPeerAccessAlreadyEnabled if peer access is already enabled for this device.
                  - +
                  @@ -222,7 +226,7 @@ Functions - + @@ -234,7 +238,7 @@ Functions - + @@ -254,9 +258,9 @@ Functions
                  Parameters
                  int dstDevice, dstDeviceId,
                  int srcDevice, srcDeviceId,
                  - + - +
                  [out]dst- Destination device pointer.
                  [in]dstDevice- Destination device
                  [in]dstDeviceId- Destination device
                  [in]src- Source device pointer
                  [in]srcDevice- Source device
                  [in]srcDeviceId- Source device
                  [in]sizeBytes- Size of memory copy in bytes
                  @@ -265,7 +269,7 @@ Functions
                  - +
                  @@ -326,15 +330,14 @@ Functions

                  Returns hipSuccess, hipErrorInvalidValue, hipErrorInvalidDevice

                  -
                  Bug:
                  This function uses a synchronous copy
                  -
                  Bug:
                  This function uses a synchronous copy
                  +
                  Bug:
                  This function uses a synchronous copy
                  diff --git a/docs/RuntimeAPI/html/group__Profiler.html b/docs/RuntimeAPI/html/group__Profiler.html index e79a0cf5b1..c3f7a5a494 100644 --- a/docs/RuntimeAPI/html/group__Profiler.html +++ b/docs/RuntimeAPI/html/group__Profiler.html @@ -85,7 +85,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/group__Stream.html b/docs/RuntimeAPI/html/group__Stream.html index bc69869054..014c6a90e0 100644 --- a/docs/RuntimeAPI/html/group__Stream.html +++ b/docs/RuntimeAPI/html/group__Stream.html @@ -87,6 +87,9 @@ Functions + + + @@ -108,6 +111,33 @@ Functions
                • cudaStreamGetPriority
                • Function Documentation

                  + +
                  +
                  +
                  hipError_t hipStreamCreateWithFlags (hipStream_t *stream, unsigned int flags)
                   Create an asynchronous stream. More...
                   
                  hipError_t hipStreamCreate (hipStream_t *stream)
                   Create an asynchronous stream. More...
                   
                  hipError_t hipStreamWaitEvent (hipStream_t stream, hipEvent_t event, unsigned int flags)
                   Make the specified compute stream wait for an event. More...
                   
                  + + + + + + + +
                  hipError_t hipStreamCreate (hipStream_t * stream)
                  +
                  + +

                  Create an asynchronous stream.

                  +
                  Parameters
                  + + +
                  [in,out]streamValid pointer to hipStream_t. This function writes the memory with the newly created stream.
                  +
                  +
                  +
                  Returns
                  hipSuccess, hipErrorInvalidValue
                  +

                  Create a new asynchronous stream. stream returns an opaque handle that can be used to reference the newly created stream in subsequent hipStream* commands. The stream is allocated on the heap and will remain allocated even if the handle goes out-of-scope. To release the memory used by the stream, applicaiton must call hipStreamDestroy.

                  +
                  See Also
                  hipStreamDestroy
                  + +
                  +
                  @@ -277,15 +307,14 @@ Functions
                  Returns
                  hipSuccess, hipErrorInvalidResourceHandle

                  This function inserts a wait operation into the specified stream. All future work submitted to stream will wait until event reports completion before beginning execution. This function is host-asynchronous and the function may return before the wait has completed.

                  -
                  Bug:
                  This function conservatively waits for all work in the specified stream to complete.
                  -
                  Bug:
                  This function conservatively waits for all work in the specified stream to complete.
                  +
                  Bug:
                  This function conservatively waits for all work in the specified stream to complete.
                  diff --git a/docs/RuntimeAPI/html/group__Texture.html b/docs/RuntimeAPI/html/group__Texture.html index 158b63a9ad..0778a5319c 100644 --- a/docs/RuntimeAPI/html/group__Texture.html +++ b/docs/RuntimeAPI/html/group__Texture.html @@ -90,15 +90,15 @@ template<class T >   template<class T , int dim, enum hipTextureReadMode readMode> -hipError_t hipBindTexture (size_t *offset, struct texture< T, dim, readMode > &tex, const void *devPtr, const struct hipChannelFormatDesc *desc, size_t size=UINT_MAX) +hipError_t hipBindTexture (size_t *offset, struct texture< T, dim, readMode > &tex, const void *devPtr, const struct hipChannelFormatDesc *desc, size_t size=UINT_MAX)   template<class T , int dim, enum hipTextureReadMode readMode> -hipError_t hipBindTexture (size_t *offset, struct texture< T, dim, readMode > &tex, const void *devPtr, size_t size=UINT_MAX) +hipError_t hipBindTexture (size_t *offset, struct texture< T, dim, readMode > &tex, const void *devPtr, size_t size=UINT_MAX)   template<class T , int dim, enum hipTextureReadMode readMode> -hipError_t hipUnbindTexture (struct texture< T, dim, readMode > *tex) +hipError_t hipUnbindTexture (struct texture< T, dim, readMode > *tex)  

                  Detailed Description

                  @@ -121,7 +121,7 @@ template<class T , int dim, enum hipTextureReadMode readMode> diff --git a/docs/RuntimeAPI/html/group__Version.html b/docs/RuntimeAPI/html/group__Version.html index e1639f5f88..86b02f28a9 100644 --- a/docs/RuntimeAPI/html/group__Version.html +++ b/docs/RuntimeAPI/html/group__Version.html @@ -114,7 +114,7 @@ Functions diff --git a/docs/RuntimeAPI/html/globals_vars.html b/docs/RuntimeAPI/html/hcc_8h_source.html similarity index 73% rename from docs/RuntimeAPI/html/globals_vars.html rename to docs/RuntimeAPI/html/hcc_8h_source.html index 8bc92d3188..5b2a7aa240 100644 --- a/docs/RuntimeAPI/html/globals_vars.html +++ b/docs/RuntimeAPI/html/hcc_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: File Members +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc.h Source File @@ -62,21 +62,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - -
                  + + +
                  +
                  +
                  hcc.h
                  +
                  -
                  +
                  1 #ifndef HCC_H
                  +
                  2 #define HCC_H
                  +
                  3 
                  +
                  4 #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__)
                  +
                  5 #include <hcc_detail/hcc_acc.h>
                  +
                  6 #endif
                  +
                  7 
                  +
                  8 #endif
                  +
                  diff --git a/docs/RuntimeAPI/html/hcc__acc_8h_source.html b/docs/RuntimeAPI/html/hcc__acc_8h_source.html new file mode 100644 index 0000000000..5ae15a291a --- /dev/null +++ b/docs/RuntimeAPI/html/hcc__acc_8h_source.html @@ -0,0 +1,118 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hcc_acc.h Source File + + + + + + + + + +
                  +
                  + + + + + + +
                  +
                  HIP: Heterogenous-computing Interface for Portability +
                  +
                  +
                  + + + + + + + + + +
                  + +
                  + + +
                  +
                  +
                  +
                  hcc_acc.h
                  +
                  +
                  +
                  1 #ifndef HCC_ACC_H
                  +
                  2 #define HCC_ACC_H
                  +
                  3 #include "hip_runtime_api.h"
                  +
                  4 
                  +
                  5 #if __cplusplus
                  +
                  6 #ifdef __HCC__
                  +
                  7 #include <hc.hpp>
                  +
                  11 hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc);
                  +
                  12 
                  +
                  16 hipError_t hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av);
                  +
                  17 #endif
                  +
                  18 #endif
                  +
                  19 
                  +
                  20 #endif
                  +
                  hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc)
                  Definition: hip_hcc.cpp:1372
                  +
                  hipError_t
                  Definition: hip_runtime_api.h:142
                  +
                  hipError_t hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av)
                  Definition: hip_hcc.cpp:1392
                  +
                  Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
                  +
                  + + + + diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h.html b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h.html index 3b02f3756a..950a3befde 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/hip_runtime.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_runtime.h File Reference @@ -96,16 +96,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

                  Contains definitions of APIs for HIP runtime. More...

                  -
                  #include <cstring>
                  -#include <cmath>
                  -#include <string.h>
                  +
                  #include <string.h>
                  #include <stddef.h>
                  #include <hip_runtime_api.h>
                  -#include <hc.hpp>
                  #include <grid_launch.h>
                  -#include <hcc_detail/hip_texture.h>
                  #include <hcc_detail/host_defines.h>
                  -#include <hc_math.hpp>

                  Go to the source code of this file.

                  @@ -164,10 +159,6 @@ Macros - - - -
                  #define HIP_KERNEL_NAME(...)   __VA_ARGS__
                   
                  #define KERNELBEGIN
                   
                  #define KERNELEND
                   
                  @@ -177,239 +168,15 @@ __device__ long long int  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

                  Functions

                  c
                  __device__ clock_t clock ()
                   
                  -__device__ int atomicAdd (int *address, int val)
                   
                  -__device__ unsigned int atomicAdd (unsigned int *address, unsigned int val)
                   
                  -__device__ unsigned long long int atomicAdd (unsigned long long int *address, unsigned long long int val)
                   
                  -__device__ float atomicAdd (float *address, float val)
                   
                  -__device__ int atomicSub (int *address, int val)
                   
                  -__device__ unsigned int atomicSub (unsigned int *address, unsigned int val)
                   
                  -__device__ int atomicExch (int *address, int val)
                   
                  -__device__ unsigned int atomicExch (unsigned int *address, unsigned int val)
                   
                  -__device__ unsigned long long int atomicExch (unsigned long long int *address, unsigned long long int val)
                   
                  -__device__ float atomicExch (float *address, float val)
                   
                  -__device__ int atomicMin (int *address, int val)
                   
                  -__device__ unsigned int atomicMin (unsigned int *address, unsigned int val)
                   
                  -__device__ unsigned long long int atomicMin (unsigned long long int *address, unsigned long long int val)
                   
                  -__device__ int atomicMax (int *address, int val)
                   
                  -__device__ unsigned int atomicMax (unsigned int *address, unsigned int val)
                   
                  -__device__ unsigned long long int atomicMax (unsigned long long int *address, unsigned long long int val)
                   
                  -__device__ int atomicCAS (int *address, int compare, int val)
                   
                  -__device__ unsigned int atomicCAS (unsigned int *address, unsigned int compare, unsigned int val)
                   
                  -__device__ unsigned long long int atomicCAS (unsigned long long int *address, unsigned long long int compare, unsigned long long int val)
                   
                  -__device__ int atomicAnd (int *address, int val)
                   
                  -__device__ unsigned int atomicAnd (unsigned int *address, unsigned int val)
                   
                  -__device__ unsigned long long int atomicAnd (unsigned long long int *address, unsigned long long int val)
                   
                  -__device__ int atomicOr (int *address, int val)
                   
                  -__device__ unsigned int atomicOr (unsigned int *address, unsigned int val)
                   
                  -__device__ unsigned long long int atomicOr (unsigned long long int *address, unsigned long long int val)
                   
                  -__device__ int atomicXor (int *address, int val)
                   
                  -__device__ unsigned int atomicXor (unsigned int *address, unsigned int val)
                   
                  -__device__ unsigned long long int atomicXor (unsigned long long int *address, unsigned long long int val)
                   
                  -__device__ unsigned int __popc (unsigned int input)
                   
                  -__device__ unsigned int __popcll (unsigned long long int input)
                   
                  -__device__ unsigned int __clz (unsigned int input)
                   
                  -__device__ unsigned int __clzll (unsigned long long int input)
                   
                  -__device__ unsigned int __clz (int input)
                   
                  -__device__ unsigned int __clzll (long long int input)
                   
                  -__device__ unsigned int __ffs (unsigned int input)
                   
                  -__device__ unsigned int __ffsll (unsigned long long int input)
                   
                  -__device__ unsigned int __ffs (int input)
                   
                  -__device__ unsigned int __ffsll (long long int input)
                   
                  -__device__ unsigned int __brev (unsigned int input)
                   
                  -__device__ unsigned long long int __brevll (unsigned long long int input)
                   
                  -__device__ int __all (int input)
                   
                  -__device__ int __any (int input)
                   
                  -__device__ unsigned long long int __ballot (int input)
                   
                  -__device__ int __shfl (int input, int lane, int width=warpSize)
                   
                  -__device__ int __shfl_up (int input, unsigned int lane_delta, int width=warpSize)
                   
                  -__device__ int __shfl_down (int input, unsigned int lane_delta, int width=warpSize)
                   
                  -__device__ int __shfl_xor (int input, int lane_mask, int width=warpSize)
                   
                  -__device__ float __shfl (float input, int lane, int width=warpSize)
                   
                  -__device__ float __shfl_up (float input, unsigned int lane_delta, int width=warpSize)
                   
                  -__device__ float __shfl_down (float input, unsigned int lane_delta, int width=warpSize)
                   
                  -__device__ float __shfl_xor (float input, int lane_mask, int width=warpSize)
                   
                  -int min (int arg1, int arg2) __attribute((hc
                   
                  -int max (int arg1, int arg2) __attribute((hc
                   
                  -__device__ float __cosf (float x)
                   
                  -__device__ float __expf (float x)
                   
                  -__device__ float __frsqrt_rn (float x)
                   
                  -__device__ float __fsqrt_rd (float x)
                   
                  -__device__ float __fsqrt_rn (float x)
                   
                  -__device__ float __fsqrt_ru (float x)
                   
                  -__device__ float __fsqrt_rz (float x)
                   
                  -__device__ float __log10f (float x)
                   
                  -__device__ float __log2f (float x)
                   
                  -__device__ float __logf (float x)
                   
                  -__device__ float __powf (float base, float exponent)
                   
                  -__device__ void __sincosf (float x, float *s, float *c)
                   
                  -__device__ float __sinf (float x)
                   
                  -__device__ float __tanf (float x)
                   
                  -__device__ float __dsqrt_rd (double x)
                   
                  -__device__ float __dsqrt_rn (double x)
                   
                  -__device__ float __dsqrt_ru (double x)
                   
                  -__device__ float __dsqrt_rz (double x)
                   
                  + + +const int  - - - - - - - - - - -

                  Variables

                  +int HIP_TRACE_API
                   
                  -const int warpSize = 64
                  warpSize
                   
                  int cpu
                   
                  -int HIP_PRINT_ENV
                   Print all HIP-related environment variables.
                   
                  -int HIP_TRACE_API
                   Trace HIP APIs.
                   
                  -int HIP_LAUNCH_BLOCKING
                   Make all HIP APIs host-synchronous.
                   

                  Detailed Description

                  Contains definitions of APIs for HIP runtime.

                  @@ -425,73 +192,12 @@ int 

                  Kernel launching

                  -
                  -
                  - -
                  -
                  - - - - -
                  #define KERNELBEGIN
                  -
                  -Value:
                  hc::extent<3> ext(lp.gridDim.x, lp.gridDim.y, lp.gridDim.z);\
                  -
                  auto __hipExtTile = ext.tile(lp.groupDim.x, lp.groupDim.y, lp.groupDim.z);\
                  -
                  __hipExtTile.set_dynamic_group_segment_size(lp.groupMemBytes);\
                  -
                  \
                  -
                  hc::completion_future cf = \
                  -
                  hc::parallel_for_each (\
                  -
                  *lp.av,\
                  -
                  __hipExtTile,\
                  -
                  [=] (hc::tiled_index<3> __hipIdx) mutable [[hc]] \
                  -
                  {
                  -
                  -
                  -
                  - -
                  -
                  - - - - -
                  #define KERNELEND
                  -
                  -Value:
                  }); \
                  - -
                  if (HIP_TRACE_API) {\
                  -
                  fprintf(stderr, "hiptrace1: HIP_LAUNCH_BLOCKING ...\n");\
                  -
                  }\
                  -
                  cf.wait(); \
                  -
                  if (HIP_TRACE_API) {\
                  -
                  fprintf(stderr, "hiptrace1: ...completed.\n");\
                  -
                  }\
                  -
                  }
                  -
                  int HIP_TRACE_API
                  Trace HIP APIs.
                  Definition: hip_hcc.cpp:73
                  -
                  int HIP_LAUNCH_BLOCKING
                  Make all HIP APIs host-synchronous.
                  Definition: hip_hcc.cpp:70
                  -
                  -
                  -
                  -

                  Variable Documentation

                  - -
                  -
                  - - - - -
                  int cpu
                  -
                  -Initial value:
                  {
                  -
                  return (int)(hc::precise_math::fmin((float)arg1, (float)arg2))
                  -
                  diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h_source.html b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h_source.html index 4a9b0d1073..1ebb8604cd 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h_source.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/hip_runtime.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_runtime.h Source File @@ -110,580 +110,550 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
                  20 THE SOFTWARE.
                  21 */
                  -
                  27 #pragma once
                  -
                  28 
                  -
                  29 //---
                  -
                  30 // Top part of file can be compiled with any compiler
                  -
                  31 
                  -
                  32 
                  -
                  33 #include <cstring>
                  -
                  34 #include <cmath>
                  -
                  35 #include <string.h>
                  -
                  36 #include <stddef.h>
                  -
                  37 
                  -
                  38 
                  -
                  39 #define CUDA_SUCCESS hipSuccess
                  -
                  40 
                  -
                  41 #include <hip_runtime_api.h>
                  -
                  42 
                  -
                  43 //---
                  -
                  44 // Remainder of this file only compiles with HCC
                  -
                  45 #ifdef __HCC__
                  -
                  46 #include <hc.hpp>
                  -
                  47 #include <grid_launch.h>
                  -
                  48 
                  -
                  49 //TODO-HCC-GL - change this to typedef.
                  -
                  50 //typedef grid_launch_parm hipLaunchParm ;
                  -
                  51 #define hipLaunchParm grid_launch_parm
                  -
                  52 
                  -
                  53 #include <hcc_detail/hip_texture.h>
                  - -
                  55 
                  -
                  56 // TODO-HCC remove old definitions ; ~1602 hcc supports __HCC_ACCELERATOR__ define.
                  -
                  57 #if defined (__KALMAR_ACCELERATOR__) && not defined (__HCC_ACCELERATOR__)
                  -
                  58 #define __HCC_ACCELERATOR__ __KALMAR_ACCELERATOR__
                  -
                  59 #endif
                  -
                  60 
                  -
                  61 // Feature tests:
                  -
                  62 #if defined(__HCC_ACCELERATOR__) and (__HCC_ACCELERATOR__ != 0)
                  -
                  63 // Device compile and not host compile:
                  -
                  64 
                  -
                  65 //TODO-HCC enable __HIP_ARCH_HAS_ATOMICS__ when HCC supports these.
                  -
                  66  // 32-bit Atomics:
                  -
                  67 #define __HIP_ARCH_HAS_GLOBAL_INT32_ATOMICS__ (1)
                  -
                  68 #define __HIP_ARCH_HAS_GLOBAL_FLOAT_ATOMIC_EXCH__ (1)
                  -
                  69 #define __HIP_ARCH_HAS_SHARED_INT32_ATOMICS__ (1)
                  -
                  70 #define __HIP_ARCH_HAS_SHARED_FLOAT_ATOMIC_EXCH__ (1)
                  -
                  71 #define __HIP_ARCH_HAS_FLOAT_ATOMIC_ADD__ (0)
                  -
                  72 
                  -
                  73 // 64-bit Atomics:
                  -
                  74 #define __HIP_ARCH_HAS_GLOBAL_INT64_ATOMICS__ (1)
                  -
                  75 #define __HIP_ARCH_HAS_SHARED_INT64_ATOMICS__ (0)
                  -
                  76 
                  -
                  77 // Doubles
                  -
                  78 #define __HIP_ARCH_HAS_DOUBLES__ (1)
                  -
                  79 
                  -
                  80 //warp cross-lane operations:
                  -
                  81 #define __HIP_ARCH_HAS_WARP_VOTE__ (1)
                  -
                  82 #define __HIP_ARCH_HAS_WARP_BALLOT__ (1)
                  -
                  83 #define __HIP_ARCH_HAS_WARP_SHUFFLE__ (1)
                  -
                  84 #define __HIP_ARCH_HAS_WARP_FUNNEL_SHIFT__ (0)
                  -
                  85 
                  -
                  86 //sync
                  -
                  87 #define __HIP_ARCH_HAS_THREAD_FENCE_SYSTEM__ (0)
                  -
                  88 #define __HIP_ARCH_HAS_SYNC_THREAD_EXT__ (0)
                  -
                  89 
                  -
                  90 // misc
                  -
                  91 #define __HIP_ARCH_HAS_SURFACE_FUNCS__ (0)
                  -
                  92 #define __HIP_ARCH_HAS_3DGRID__ (1)
                  -
                  93 #define __HIP_ARCH_HAS_DYNAMIC_PARALLEL__ (0)
                  +
                  27 //#pragma once
                  +
                  28 #ifndef HIP_RUNTIME_H
                  +
                  29 #define HIP_RUNTIME_H
                  +
                  30 
                  +
                  31 //---
                  +
                  32 // Top part of file can be compiled with any compiler
                  +
                  33 
                  +
                  34 
                  +
                  35 //#include <cstring>
                  +
                  36 //#include <cmath>
                  +
                  37 #include <string.h>
                  +
                  38 #include <stddef.h>
                  +
                  39 
                  +
                  40 
                  +
                  41 #define CUDA_SUCCESS hipSuccess
                  +
                  42 
                  +
                  43 #include <hip_runtime_api.h>
                  +
                  44 //#include "hcc_detail/hip_hcc.h"
                  +
                  45 //---
                  +
                  46 // Remainder of this file only compiles with HCC
                  +
                  47 #ifdef __HCC__
                  +
                  48 #if __cplusplus
                  +
                  49 #include <hc.hpp>
                  +
                  50 #endif
                  +
                  51 #include <grid_launch.h>
                  +
                  52 extern int HIP_TRACE_API;
                  +
                  53 
                  +
                  54 //TODO-HCC-GL - change this to typedef.
                  +
                  55 //typedef grid_launch_parm hipLaunchParm ;
                  +
                  56 #define hipLaunchParm grid_launch_parm
                  +
                  57 #ifdef __cplusplus
                  +
                  58 #include <hcc_detail/hip_texture.h>
                  +
                  59 #endif
                  + +
                  61 // TODO-HCC remove old definitions ; ~1602 hcc supports __HCC_ACCELERATOR__ define.
                  +
                  62 #if defined (__KALMAR_ACCELERATOR__) && !defined (__HCC_ACCELERATOR__)
                  +
                  63 #define __HCC_ACCELERATOR__ __KALMAR_ACCELERATOR__
                  +
                  64 #endif
                  +
                  65 
                  +
                  66 // Feature tests:
                  +
                  67 #if defined(__HCC_ACCELERATOR__) && (__HCC_ACCELERATOR__ != 0)
                  +
                  68 // Device compile and not host compile:
                  +
                  69 
                  +
                  70 //TODO-HCC enable __HIP_ARCH_HAS_ATOMICS__ when HCC supports these.
                  +
                  71  // 32-bit Atomics:
                  +
                  72 #define __HIP_ARCH_HAS_GLOBAL_INT32_ATOMICS__ (1)
                  +
                  73 #define __HIP_ARCH_HAS_GLOBAL_FLOAT_ATOMIC_EXCH__ (1)
                  +
                  74 #define __HIP_ARCH_HAS_SHARED_INT32_ATOMICS__ (1)
                  +
                  75 #define __HIP_ARCH_HAS_SHARED_FLOAT_ATOMIC_EXCH__ (1)
                  +
                  76 #define __HIP_ARCH_HAS_FLOAT_ATOMIC_ADD__ (0)
                  +
                  77 
                  +
                  78 // 64-bit Atomics:
                  +
                  79 #define __HIP_ARCH_HAS_GLOBAL_INT64_ATOMICS__ (1)
                  +
                  80 #define __HIP_ARCH_HAS_SHARED_INT64_ATOMICS__ (0)
                  +
                  81 
                  +
                  82 // Doubles
                  +
                  83 #define __HIP_ARCH_HAS_DOUBLES__ (1)
                  +
                  84 
                  +
                  85 //warp cross-lane operations:
                  +
                  86 #define __HIP_ARCH_HAS_WARP_VOTE__ (1)
                  +
                  87 #define __HIP_ARCH_HAS_WARP_BALLOT__ (1)
                  +
                  88 #define __HIP_ARCH_HAS_WARP_SHUFFLE__ (1)
                  +
                  89 #define __HIP_ARCH_HAS_WARP_FUNNEL_SHIFT__ (0)
                  +
                  90 
                  +
                  91 //sync
                  +
                  92 #define __HIP_ARCH_HAS_THREAD_FENCE_SYSTEM__ (0)
                  +
                  93 #define __HIP_ARCH_HAS_SYNC_THREAD_EXT__ (0)
                  94 
                  -
                  95 #endif
                  -
                  96 
                  -
                  97 
                  -
                  98 
                  -
                  99 
                  -
                  100 
                  -
                  101 //TODO-HCC this is currently ignored by HCC target of HIP
                  -
                  102 #define __launch_bounds__(requiredMaxThreadsPerBlock, minBlocksPerMultiprocessor)
                  -
                  103 
                  -
                  104 // Detect if we are compiling C++ mode or C mode
                  -
                  105 #if defined(__cplusplus)
                  -
                  106 #define __HCC_CPP__
                  -
                  107 #elif defined(__STDC_VERSION__)
                  -
                  108 #define __HCC_C__
                  -
                  109 #endif
                  -
                  110 
                  -
                  111 
                  -
                  112 // TODO - hipify-clang - change to use the function call.
                  -
                  113 //#define warpSize hc::__wavesize()
                  -
                  114 const int warpSize = 64;
                  -
                  115 
                  -
                  116 
                  -
                  117 #define clock_t long long int
                  -
                  118 __device__ inline long long int clock64() { return (long long int)hc::__clock_u64(); };
                  -
                  119 __device__ inline clock_t clock() { return (clock_t)hc::__clock_u64(); };
                  -
                  120 
                  -
                  121 //atomicAdd()
                  -
                  122 __device__ inline int atomicAdd(int* address, int val)
                  -
                  123 {
                  -
                  124  return hc::atomic_fetch_add(address,val);
                  -
                  125 }
                  -
                  126 __device__ inline unsigned int atomicAdd(unsigned int* address,
                  -
                  127  unsigned int val)
                  -
                  128 {
                  -
                  129  return hc::atomic_fetch_add(address,val);
                  -
                  130 }
                  -
                  131 __device__ inline unsigned long long int atomicAdd(unsigned long long int* address,
                  -
                  132  unsigned long long int val)
                  -
                  133 {
                  -
                  134  return (long long int)hc::atomic_fetch_add((uint64_t*)address,(uint64_t)val);
                  -
                  135 }
                  -
                  136 __device__ inline float atomicAdd(float* address, float val)
                  -
                  137 {
                  -
                  138  return hc::atomic_fetch_add(address,val);
                  -
                  139 }
                  -
                  140 
                  -
                  141 //atomicSub()
                  -
                  142 __device__ inline int atomicSub(int* address, int val)
                  -
                  143 {
                  -
                  144  return hc::atomic_fetch_sub(address,val);
                  -
                  145 }
                  -
                  146 __device__ inline unsigned int atomicSub(unsigned int* address,
                  -
                  147  unsigned int val)
                  -
                  148 {
                  -
                  149  return hc::atomic_fetch_sub(address,val);
                  -
                  150 }
                  -
                  151 
                  -
                  152 //atomicExch()
                  -
                  153 __device__ inline int atomicExch(int* address, int val)
                  -
                  154 {
                  -
                  155  return hc::atomic_exchange(address,val);
                  -
                  156 }
                  -
                  157 __device__ inline unsigned int atomicExch(unsigned int* address,
                  -
                  158  unsigned int val)
                  -
                  159 {
                  -
                  160  return hc::atomic_exchange(address,val);
                  -
                  161 }
                  -
                  162 __device__ inline unsigned long long int atomicExch(unsigned long long int* address,
                  -
                  163  unsigned long long int val)
                  -
                  164 {
                  -
                  165  return (long long int)hc::atomic_exchange((uint64_t*)address,(uint64_t)val);
                  -
                  166 }
                  -
                  167 __device__ inline float atomicExch(float* address, float val)
                  -
                  168 {
                  -
                  169  return hc::atomic_exchange(address,val);
                  -
                  170 }
                  -
                  171 
                  -
                  172 //atomicMin()
                  -
                  173 __device__ inline int atomicMin(int* address, int val)
                  -
                  174 {
                  -
                  175  return hc::atomic_fetch_min(address,val);
                  -
                  176 }
                  -
                  177 __device__ inline unsigned int atomicMin(unsigned int* address,
                  -
                  178  unsigned int val)
                  -
                  179 {
                  -
                  180  return hc::atomic_fetch_min(address,val);
                  -
                  181 }
                  -
                  182 __device__ inline unsigned long long int atomicMin(unsigned long long int* address,
                  -
                  183  unsigned long long int val)
                  -
                  184 {
                  -
                  185  return (long long int)hc::atomic_fetch_min((uint64_t*)address,(uint64_t)val);
                  -
                  186 }
                  -
                  187 
                  -
                  188 //atomicMax()
                  -
                  189 __device__ inline int atomicMax(int* address, int val)
                  -
                  190 {
                  -
                  191  return hc::atomic_fetch_max(address,val);
                  -
                  192 }
                  -
                  193 __device__ inline unsigned int atomicMax(unsigned int* address,
                  -
                  194  unsigned int val)
                  -
                  195 {
                  -
                  196  return hc::atomic_fetch_max(address,val);
                  -
                  197 }
                  -
                  198 __device__ inline unsigned long long int atomicMax(unsigned long long int* address,
                  -
                  199  unsigned long long int val)
                  -
                  200 {
                  -
                  201  return (long long int)hc::atomic_fetch_max((uint64_t*)address,(uint64_t)val);
                  -
                  202 }
                  -
                  203 
                  -
                  204 //atomicCAS()
                  -
                  205 __device__ inline int atomicCAS(int* address, int compare, int val)
                  -
                  206 {
                  -
                  207  hc::atomic_compare_exchange(address,&compare,val);
                  -
                  208  return *address;
                  -
                  209 }
                  -
                  210 __device__ inline unsigned int atomicCAS(unsigned int* address,
                  -
                  211  unsigned int compare,
                  -
                  212  unsigned int val)
                  -
                  213 {
                  -
                  214  hc::atomic_compare_exchange(address,&compare,val);
                  -
                  215  return *address;
                  -
                  216 }
                  -
                  217 __device__ inline unsigned long long int atomicCAS(unsigned long long int* address,
                  -
                  218  unsigned long long int compare,
                  -
                  219  unsigned long long int val)
                  -
                  220 {
                  -
                  221  hc::atomic_compare_exchange((uint64_t*)address,(uint64_t*)&compare,(uint64_t)val);
                  -
                  222  return *address;
                  -
                  223 }
                  -
                  224 
                  -
                  225 //atomicAnd()
                  -
                  226 __device__ inline int atomicAnd(int* address, int val)
                  -
                  227 {
                  -
                  228  return hc::atomic_fetch_and(address,val);
                  -
                  229 }
                  -
                  230 __device__ inline unsigned int atomicAnd(unsigned int* address,
                  -
                  231  unsigned int val)
                  -
                  232 {
                  -
                  233  return hc::atomic_fetch_and(address,val);
                  -
                  234 }
                  -
                  235 __device__ inline unsigned long long int atomicAnd(unsigned long long int* address,
                  -
                  236  unsigned long long int val)
                  -
                  237 {
                  -
                  238  return (long long int)hc::atomic_fetch_and((uint64_t*)address,(uint64_t)val);
                  -
                  239 }
                  -
                  240 
                  -
                  241 //atomicOr()
                  -
                  242 __device__ inline int atomicOr(int* address, int val)
                  -
                  243 {
                  -
                  244  return hc::atomic_fetch_or(address,val);
                  -
                  245 }
                  -
                  246 __device__ inline unsigned int atomicOr(unsigned int* address,
                  -
                  247  unsigned int val)
                  -
                  248 {
                  -
                  249  return hc::atomic_fetch_or(address,val);
                  -
                  250 }
                  -
                  251 __device__ inline unsigned long long int atomicOr(unsigned long long int* address,
                  -
                  252  unsigned long long int val)
                  -
                  253 {
                  -
                  254  return (long long int)hc::atomic_fetch_or((uint64_t*)address,(uint64_t)val);
                  -
                  255 }
                  -
                  256 
                  -
                  257 //atomicXor()
                  -
                  258 __device__ inline int atomicXor(int* address, int val)
                  -
                  259 {
                  -
                  260  return hc::atomic_fetch_xor(address,val);
                  -
                  261 }
                  -
                  262 __device__ inline unsigned int atomicXor(unsigned int* address,
                  -
                  263  unsigned int val)
                  -
                  264 {
                  -
                  265  return hc::atomic_fetch_xor(address,val);
                  -
                  266 }
                  -
                  267 __device__ inline unsigned long long int atomicXor(unsigned long long int* address,
                  -
                  268  unsigned long long int val)
                  -
                  269 {
                  -
                  270  return (long long int)hc::atomic_fetch_xor((uint64_t*)address,(uint64_t)val);
                  -
                  271 }
                  -
                  272 
                  -
                  273 #include <hc.hpp>
                  -
                  274 // integer intrinsic function __poc __clz __ffs __brev
                  -
                  275 __device__ inline unsigned int __popc( unsigned int input)
                  -
                  276 {
                  -
                  277  return hc::__popcount_u32_b32( input);
                  -
                  278 }
                  -
                  279 
                  -
                  280 __device__ inline unsigned int __popcll( unsigned long long int input)
                  -
                  281 {
                  -
                  282  return hc::__popcount_u32_b64(input);
                  -
                  283 }
                  -
                  284 
                  -
                  285 __device__ inline unsigned int __clz(unsigned int input)
                  -
                  286 {
                  -
                  287  return hc::__firstbit_u32_u32( input);
                  -
                  288 }
                  -
                  289 
                  -
                  290 __device__ inline unsigned int __clzll(unsigned long long int input)
                  -
                  291 {
                  -
                  292  return hc::__firstbit_u32_u64( input);
                  -
                  293 }
                  -
                  294 
                  -
                  295 __device__ inline unsigned int __clz(int input)
                  -
                  296 {
                  -
                  297  return hc::__firstbit_u32_s32( input);
                  -
                  298 }
                  +
                  95 // misc
                  +
                  96 #define __HIP_ARCH_HAS_SURFACE_FUNCS__ (0)
                  +
                  97 #define __HIP_ARCH_HAS_3DGRID__ (1)
                  +
                  98 #define __HIP_ARCH_HAS_DYNAMIC_PARALLEL__ (0)
                  +
                  99 
                  +
                  100 #endif
                  +
                  101 
                  +
                  102 
                  +
                  103 //TODO-HCC this is currently ignored by HCC target of HIP
                  +
                  104 #define __launch_bounds__(requiredMaxThreadsPerBlock, minBlocksPerMultiprocessor)
                  +
                  105 
                  +
                  106 // Detect if we are compiling C++ mode or C mode
                  +
                  107 #if defined(__cplusplus)
                  +
                  108 #define __HCC_CPP__
                  +
                  109 #elif defined(__STDC_VERSION__)
                  +
                  110 #define __HCC_C__
                  +
                  111 #endif
                  +
                  112 
                  +
                  113 #if __cplusplus
                  +
                  114 __device__ float acosf(float x);
                  +
                  115 __device__ float acoshf(float x);
                  +
                  116 __device__ float asinf(float x);
                  +
                  117 __device__ float asinhf(float x);
                  +
                  118 __device__ float atan2f(float y, float x);
                  +
                  119 __device__ float atanf(float x);
                  +
                  120 __device__ float atanhf(float x);
                  +
                  121 __device__ float cbrtf(float x);
                  +
                  122 __device__ float ceilf(float x);
                  +
                  123 __device__ float copysignf(float x, float y);
                  +
                  124 __device__ float cosf(float x);
                  +
                  125 __device__ float coshf(float x);
                  +
                  126 __device__ float cyl_bessel_i0f(float x);
                  +
                  127 __device__ float cyl_bessel_i1f(float x);
                  +
                  128 __device__ float erfcf(float x);
                  +
                  129 __device__ float erfcinvf(float y);
                  +
                  130 __device__ float erfcxf(float x);
                  +
                  131 __device__ float erff(float x);
                  +
                  132 __device__ float erfinvf(float y);
                  +
                  133 __device__ float exp10f(float x);
                  +
                  134 __device__ float exp2f(float x);
                  +
                  135 __device__ float expf(float x);
                  +
                  136 __device__ float expm1f(float x);
                  +
                  137 __device__ float fabsf(float x);
                  +
                  138 __device__ float fdimf(float x, float y);
                  +
                  139 __device__ float fdividef(float x, float y);
                  +
                  140 __device__ float floorf(float x);
                  +
                  141 __device__ float fmaf(float x, float y, float z);
                  +
                  142 __device__ float fmaxf(float x, float y);
                  +
                  143 __device__ float fminf(float x, float y);
                  +
                  144 __device__ float fmodf(float x, float y);
                  +
                  145 __device__ float frexpf(float x, float y);
                  +
                  146 __device__ float hypotf(float x, float y);
                  +
                  147 __device__ float ilogbf(float x);
                  +
                  148 __device__ unsigned isfinite(float a);
                  +
                  149 __device__ unsigned isinf(float a);
                  +
                  150 __device__ unsigned isnan(float a);
                  +
                  151 __device__ float j0f(float x);
                  +
                  152 __device__ float j1f(float x);
                  +
                  153 __device__ float jnf(int n, float x);
                  +
                  154 __device__ float ldexpf(float x, int exp);
                  +
                  155 __device__ float lgammaf(float x);
                  +
                  156 __device__ long long int llrintf(float x);
                  +
                  157 __device__ long long int llroundf(float x);
                  +
                  158 __device__ float log10f(float x);
                  +
                  159 __device__ float log1pf(float x);
                  +
                  160 __device__ float log2f(float x);
                  +
                  161 __device__ float logbf(float x);
                  +
                  162 __device__ float logf(float x);
                  +
                  163 __device__ long int lrintf(float x);
                  +
                  164 __device__ long int lroundf(float x);
                  +
                  165 __device__ float modff(float x, float *iptr);
                  +
                  166 __device__ float nanf(const char* tagp);
                  +
                  167 __device__ float nearbyintf(float x);
                  +
                  168 __device__ float nextafterf(float x, float y);
                  +
                  169 __device__ float norm3df(float a, float b, float c);
                  +
                  170 __device__ float norm4df(float a, float b, float c, float d);
                  +
                  171 __device__ float normcdff(float y);
                  +
                  172 __device__ float normcdfinvf(float y);
                  +
                  173 __device__ float normf(int dim, const float *a);
                  +
                  174 __device__ float powf(float x, float y);
                  +
                  175 __device__ float rcbtrf(float x);
                  +
                  176 __device__ float remainderf(float x, float y);
                  +
                  177 __device__ float remquof(float x, float y, int *quo);
                  +
                  178 __device__ float rhypotf(float x, float y);
                  +
                  179 __device__ float rintf(float x);
                  +
                  180 __device__ float rnorm3df(float a, float b, float c);
                  +
                  181 __device__ float rnorm4df(float a, float b, float c, float d);
                  +
                  182 __device__ float rnormf(int dim, const float* a);
                  +
                  183 __device__ float roundf(float x);
                  +
                  184 __device__ float rsqrtf(float x);
                  +
                  185 __device__ float scalblnf(float x, long int n);
                  +
                  186 __device__ float scalbnf(float x, int n);
                  +
                  187 __device__ unsigned signbit(float a);
                  +
                  188 __device__ void sincosf(float x, float *sptr, float *cptr);
                  +
                  189 __device__ void sincospif(float x, float *sptr, float *cptr);
                  +
                  190 __device__ float sinf(float x);
                  +
                  191 __device__ float sinhf(float x);
                  +
                  192 __device__ float sinpif(float x);
                  +
                  193 __device__ float sqrtf(float x);
                  +
                  194 __device__ float tanf(float x);
                  +
                  195 __device__ float tanhf(float x);
                  +
                  196 __device__ float tgammaf(float x);
                  +
                  197 __device__ float truncf(float x);
                  +
                  198 __device__ float y0f(float x);
                  +
                  199 __device__ float y1f(float x);
                  +
                  200 __device__ float ynf(int n, float x);
                  +
                  201 
                  +
                  202 __host__ __device__ float cospif(float x);
                  +
                  203 __host__ __device__ float sinpif(float x);
                  +
                  204 __device__ float sqrtf(float x);
                  +
                  205 __host__ __device__ float rsqrtf(float x);
                  +
                  206 
                  +
                  207 __device__ double acos(double x);
                  +
                  208 __device__ double acosh(double x);
                  +
                  209 __device__ double asin(double x);
                  +
                  210 __device__ double asinh(double x);
                  +
                  211 __device__ double atan(double x);
                  +
                  212 __device__ double atan2(double y, double x);
                  +
                  213 __device__ double atanh(double x);
                  +
                  214 __device__ double cbrt(double x);
                  +
                  215 __device__ double ceil(double x);
                  +
                  216 __device__ double copysign(double x, double y);
                  +
                  217 __device__ double cos(double x);
                  +
                  218 __device__ double cosh(double x);
                  +
                  219 __host__ __device__ double cospi(double x);
                  +
                  220 __device__ double cyl_bessel_i0(double x);
                  +
                  221 __device__ double cyl_bessel_i1(double x);
                  +
                  222 __device__ double erf(double x);
                  +
                  223 __device__ double erfc(double x);
                  +
                  224 __device__ double erfcinv(double y);
                  +
                  225 __device__ double erfcx(double x);
                  +
                  226 __device__ double exp(double x);
                  +
                  227 __device__ double exp10(double x);
                  +
                  228 __device__ double exp2(double x);
                  +
                  229 __device__ double expm1(double x);
                  +
                  230 __device__ double fabs(double x);
                  +
                  231 __device__ double fdim(double x, double y);
                  +
                  232 __device__ double floor(double x);
                  +
                  233 __device__ double fma(double x, double y, double z);
                  +
                  234 __device__ double fmax(double x, double y);
                  +
                  235 __device__ double fmin(double x, double y);
                  +
                  236 __device__ double fmod(double x, double y);
                  +
                  237 __device__ double frexp(double x, int *nptr);
                  +
                  238 __device__ double hypot(double x, double y);
                  +
                  239 __device__ double ilogb(double x);
                  +
                  240 __device__ unsigned isfinite(double x);
                  +
                  241 __device__ unsigned isinf(double x);
                  +
                  242 __device__ unsigned isnan(double x);
                  +
                  243 __device__ double j0(double x);
                  +
                  244 __device__ double j1(double x);
                  +
                  245 __device__ double jn(int n, double x);
                  +
                  246 __device__ double ldexp(double x, int exp);
                  +
                  247 __device__ double lgamma(double x);
                  +
                  248 __device__ long long llrint(double x);
                  +
                  249 __device__ long llround(double x);
                  +
                  250 __device__ double log(double x);
                  +
                  251 __device__ double log10(double x);
                  +
                  252 __device__ double log1p(double x);
                  +
                  253 __device__ double log2(double x);
                  +
                  254 __device__ double logb(double x);
                  +
                  255 __device__ long int lrint(double x);
                  +
                  256 __device__ long int lround(double x);
                  +
                  257 __device__ double modf(double x, double *iptr);
                  +
                  258 __device__ double nan(const char* tagp);
                  +
                  259 __device__ double nearbyint(double x);
                  +
                  260 __device__ double nextafter(double x, double y);
                  +
                  261 __device__ double norm(int dim, const double* t);
                  +
                  262 __device__ double norm3d(double a, double b, double c);
                  +
                  263 __device__ double norm4d(double a, double b, double d);
                  +
                  264 __device__ double normcdf(double y);
                  +
                  265 __device__ double normcdfinv(double y);
                  +
                  266 __device__ double pow(double x, double y);
                  +
                  267 __device__ double rcbrt(double x);
                  +
                  268 __device__ double remainder(double x, double y);
                  +
                  269 __device__ double remquo(double x, double y, int *quo);
                  +
                  270 __device__ double rhypot(double x, double y);
                  +
                  271 __device__ double rint(double x);
                  +
                  272 __device__ double rnorm(int dim, const double* t);
                  +
                  273 __device__ double rnorm3d(double a, double b, double c);
                  +
                  274 __device__ double rnorm4d(double a, double b, double c, double d);
                  +
                  275 __device__ double round(double x);
                  +
                  276 __host__ __device__ double rsqrt(double x);
                  +
                  277 __device__ double scalbln(double x, long int n);
                  +
                  278 __device__ double scalbn(double x, int n);
                  +
                  279 __device__ unsigned signbit(double a);
                  +
                  280 __device__ double sin(double a);
                  +
                  281 __device__ double sincos(double x, double *sptr, double *cptr);
                  +
                  282 __device__ double sincospi(double x, double *sptr, double *cptr);
                  +
                  283 __device__ double sinh(double x);
                  +
                  284 __host__ __device__ double sinpi(double x);
                  +
                  285 __device__ double sqrt(double x);
                  +
                  286 __device__ double tan(double x);
                  +
                  287 __device__ double tanh(double x);
                  +
                  288 __device__ double tgamma(double x);
                  +
                  289 __device__ double trunc(double x);
                  +
                  290 __device__ double y0(double x);
                  +
                  291 __device__ double y1(double y);
                  +
                  292 __device__ double yn(int n, double x);
                  +
                  293 #endif
                  +
                  294 
                  +
                  295 // TODO - hipify-clang - change to use the function call.
                  +
                  296 //#define warpSize hc::__wavesize()
                  +
                  297 extern const int warpSize;
                  +
                  298 
                  299 
                  -
                  300 __device__ inline unsigned int __clzll(long long int input)
                  -
                  301 {
                  -
                  302  return hc::__firstbit_u32_s64( input);
                  -
                  303 }
                  -
                  304 
                  -
                  305 __device__ inline unsigned int __ffs(unsigned int input)
                  -
                  306 {
                  -
                  307  return hc::__lastbit_u32_u32( input)+1;
                  -
                  308 }
                  -
                  309 
                  -
                  310 __device__ inline unsigned int __ffsll(unsigned long long int input)
                  -
                  311 {
                  -
                  312  return hc::__lastbit_u32_u64( input)+1;
                  -
                  313 }
                  +
                  300 #define clock_t long long int
                  +
                  301 __device__ long long int clock64();
                  +
                  302 __device__ clock_t clock();
                  +
                  303 #if __cplusplus
                  +
                  304 //atomicAdd()
                  +
                  305 __device__ int atomicAdd(int* address, int val);
                  +
                  306 __device__ unsigned int atomicAdd(unsigned int* address,
                  +
                  307  unsigned int val);
                  +
                  308 
                  +
                  309 __device__ unsigned long long int atomicAdd(unsigned long long int* address,
                  +
                  310  unsigned long long int val);
                  +
                  311 
                  +
                  312 __device__ float atomicAdd(float* address, float val);
                  +
                  313 
                  314 
                  -
                  315 __device__ inline unsigned int __ffs(int input)
                  -
                  316 {
                  -
                  317  return hc::__lastbit_u32_s32( input)+1;
                  -
                  318 }
                  -
                  319 
                  -
                  320 __device__ inline unsigned int __ffsll(long long int input)
                  -
                  321 {
                  -
                  322  return hc::__lastbit_u32_s64( input)+1;
                  -
                  323 }
                  +
                  315 //atomicSub()
                  +
                  316 __device__ int atomicSub(int* address, int val);
                  +
                  317 
                  +
                  318 __device__ unsigned int atomicSub(unsigned int* address,
                  +
                  319  unsigned int val);
                  +
                  320 
                  +
                  321 
                  +
                  322 //atomicExch()
                  +
                  323 __device__ int atomicExch(int* address, int val);
                  324 
                  -
                  325 __device__ inline unsigned int __brev( unsigned int input)
                  -
                  326 {
                  -
                  327  return hc::__bitrev_b32( input);
                  -
                  328 }
                  -
                  329 
                  -
                  330 __device__ inline unsigned long long int __brevll( unsigned long long int input)
                  -
                  331 {
                  -
                  332  return hc::__bitrev_b64( input);
                  -
                  333 }
                  -
                  334 
                  -
                  335 // warp vote function __all __any __ballot
                  -
                  336 __device__ inline int __all( int input)
                  -
                  337 {
                  -
                  338  return hc::__all( input);
                  -
                  339 }
                  +
                  325 __device__ unsigned int atomicExch(unsigned int* address,
                  +
                  326  unsigned int val);
                  +
                  327 
                  +
                  328 __device__ unsigned long long int atomicExch(unsigned long long int* address,
                  +
                  329  unsigned long long int val);
                  +
                  330 
                  +
                  331 __device__ float atomicExch(float* address, float val);
                  +
                  332 
                  +
                  333 
                  +
                  334 //atomicMin()
                  +
                  335 __device__ int atomicMin(int* address, int val);
                  +
                  336 __device__ unsigned int atomicMin(unsigned int* address,
                  +
                  337  unsigned int val);
                  +
                  338 __device__ unsigned long long int atomicMin(unsigned long long int* address,
                  +
                  339  unsigned long long int val);
                  340 
                  341 
                  -
                  342 __device__ inline int __any( int input)
                  -
                  343 {
                  -
                  344  if( hc::__any( input)!=0) return 1;
                  -
                  345  else return 0;
                  -
                  346 }
                  -
                  347 
                  -
                  348 __device__ inline unsigned long long int __ballot( int input)
                  -
                  349 {
                  -
                  350  return hc::__ballot( input);
                  -
                  351 }
                  -
                  352 
                  -
                  353 // warp shuffle functions
                  -
                  354 __device__ inline int __shfl(int input, int lane, int width=warpSize)
                  -
                  355 {
                  -
                  356  return hc::__shfl(input,lane,width);
                  -
                  357 }
                  +
                  342 //atomicMax()
                  +
                  343 __device__ int atomicMax(int* address, int val);
                  +
                  344 __device__ unsigned int atomicMax(unsigned int* address,
                  +
                  345  unsigned int val);
                  +
                  346 __device__ unsigned long long int atomicMax(unsigned long long int* address,
                  +
                  347  unsigned long long int val);
                  +
                  348 
                  +
                  349 
                  +
                  350 //atomicCAS()
                  +
                  351 __device__ int atomicCAS(int* address, int compare, int val);
                  +
                  352 __device__ unsigned int atomicCAS(unsigned int* address,
                  +
                  353  unsigned int compare,
                  +
                  354  unsigned int val);
                  +
                  355 __device__ unsigned long long int atomicCAS(unsigned long long int* address,
                  +
                  356  unsigned long long int compare,
                  +
                  357  unsigned long long int val);
                  358 
                  -
                  359 __device__ inline int __shfl_up(int input, unsigned int lane_delta, int width=warpSize)
                  -
                  360 {
                  -
                  361  return hc::__shfl_up(input,lane_delta,width);
                  -
                  362 }
                  -
                  363 
                  -
                  364 __device__ inline int __shfl_down(int input, unsigned int lane_delta, int width=warpSize)
                  -
                  365 {
                  -
                  366  return hc::__shfl_down(input,lane_delta,width);
                  -
                  367 }
                  -
                  368 
                  -
                  369 __device__ inline int __shfl_xor(int input, int lane_mask, int width=warpSize)
                  -
                  370 {
                  -
                  371  return hc::__shfl_xor(input,lane_mask,width);
                  -
                  372 }
                  -
                  373 
                  -
                  374 __device__ inline float __shfl(float input, int lane, int width=warpSize)
                  -
                  375 {
                  -
                  376  return hc::__shfl(input,lane,width);
                  -
                  377 }
                  -
                  378 
                  -
                  379 __device__ inline float __shfl_up(float input, unsigned int lane_delta, int width=warpSize)
                  -
                  380 {
                  -
                  381  return hc::__shfl_up(input,lane_delta,width);
                  -
                  382 }
                  +
                  359 
                  +
                  360 //atomicAnd()
                  +
                  361 __device__ int atomicAnd(int* address, int val);
                  +
                  362 __device__ unsigned int atomicAnd(unsigned int* address,
                  +
                  363  unsigned int val);
                  +
                  364 __device__ unsigned long long int atomicAnd(unsigned long long int* address,
                  +
                  365  unsigned long long int val);
                  +
                  366 
                  +
                  367 
                  +
                  368 //atomicOr()
                  +
                  369 __device__ int atomicOr(int* address, int val);
                  +
                  370 __device__ unsigned int atomicOr(unsigned int* address,
                  +
                  371  unsigned int val);
                  +
                  372 __device__ unsigned long long int atomicOr(unsigned long long int* address,
                  +
                  373  unsigned long long int val);
                  +
                  374 
                  +
                  375 
                  +
                  376 //atomicXor()
                  +
                  377 __device__ int atomicXor(int* address, int val);
                  +
                  378 __device__ unsigned int atomicXor(unsigned int* address,
                  +
                  379  unsigned int val);
                  +
                  380 __device__ unsigned long long int atomicXor(unsigned long long int* address,
                  +
                  381  unsigned long long int val);
                  +
                  382 
                  383 
                  -
                  384 __device__ inline float __shfl_down(float input, unsigned int lane_delta, int width=warpSize)
                  -
                  385 {
                  -
                  386  return hc::__shfl_down(input,lane_delta,width);
                  -
                  387 }
                  -
                  388 
                  -
                  389 __device__ inline float __shfl_xor(float input, int lane_mask, int width=warpSize)
                  -
                  390 {
                  -
                  391  return hc::__shfl_xor(input,lane_mask,width);
                  -
                  392 }
                  -
                  393 
                  -
                  394 
                  -
                  395 #include <hc_math.hpp>
                  -
                  396 // TODO: Choose whether default is precise math or fast math based on compilation flag.
                  -
                  397 #ifdef __HCC_ACCELERATOR__
                  -
                  398 using namespace hc::precise_math;
                  -
                  399 #endif
                  -
                  400 
                  -
                  401 //TODO: Undo this once min/max functions are supported by hc
                  -
                  402 inline int min(int arg1, int arg2) __attribute((hc,cpu)) { \
                  -
                  403  return (int)(hc::precise_math::fmin((float)arg1, (float)arg2));}
                  -
                  404 inline int max(int arg1, int arg2) __attribute((hc,cpu)) { \
                  -
                  405  return (int)(hc::precise_math::fmax((float)arg1, (float)arg2));}
                  -
                  406 
                  -
                  407 
                  -
                  408 //TODO - add a couple fast math operations here, the set here will grow :
                  -
                  409 __device__ inline float __cosf(float x) {return hc::fast_math::cosf(x); };
                  -
                  410 __device__ inline float __expf(float x) {return hc::fast_math::expf(x); };
                  -
                  411 __device__ inline float __frsqrt_rn(float x) {return hc::fast_math::rsqrt(x); };
                  -
                  412 __device__ inline float __fsqrt_rd(float x) {return hc::fast_math::sqrt(x); };
                  -
                  413 __device__ inline float __fsqrt_rn(float x) {return hc::fast_math::sqrt(x); };
                  -
                  414 __device__ inline float __fsqrt_ru(float x) {return hc::fast_math::sqrt(x); };
                  -
                  415 __device__ inline float __fsqrt_rz(float x) {return hc::fast_math::sqrt(x); };
                  -
                  416 __device__ inline float __log10f(float x) {return hc::fast_math::log10f(x); };
                  -
                  417 __device__ inline float __log2f(float x) {return hc::fast_math::log2f(x); };
                  -
                  418 __device__ inline float __logf(float x) {return hc::fast_math::logf(x); };
                  -
                  419 __device__ inline float __powf(float base, float exponent) {return hc::fast_math::powf(base, exponent); };
                  -
                  420 __device__ inline void __sincosf(float x, float *s, float *c) {return hc::fast_math::sincosf(x, s, c); };
                  -
                  421 __device__ inline float __sinf(float x) {return hc::fast_math::sinf(x); };
                  -
                  422 __device__ inline float __tanf(float x) {return hc::fast_math::tanf(x); };
                  -
                  423 __device__ inline float __dsqrt_rd(double x) {return hc::fast_math::sqrt(x); };
                  -
                  424 __device__ inline float __dsqrt_rn(double x) {return hc::fast_math::sqrt(x); };
                  -
                  425 __device__ inline float __dsqrt_ru(double x) {return hc::fast_math::sqrt(x); };
                  -
                  426 __device__ inline float __dsqrt_rz(double x) {return hc::fast_math::sqrt(x); };
                  -
                  427 
                  -
                  431 #define hipThreadIdx_x (amp_get_local_id(2))
                  -
                  432 #define hipThreadIdx_y (amp_get_local_id(1))
                  -
                  433 #define hipThreadIdx_z (amp_get_local_id(0))
                  -
                  434 
                  -
                  435 #define hipBlockIdx_x (hc_get_group_id(2))
                  -
                  436 #define hipBlockIdx_y (hc_get_group_id(1))
                  -
                  437 #define hipBlockIdx_z (hc_get_group_id(0))
                  -
                  438 
                  -
                  439 #define hipBlockDim_x (amp_get_local_size(2))
                  -
                  440 #define hipBlockDim_y (amp_get_local_size(1))
                  -
                  441 #define hipBlockDim_z (amp_get_local_size(0))
                  -
                  442 
                  -
                  443 #define hipGridDim_x (hc_get_num_groups(2))
                  -
                  444 #define hipGridDim_y (hc_get_num_groups(1))
                  -
                  445 #define hipGridDim_z (hc_get_num_groups(0))
                  -
                  446 
                  -
                  447 
                  -
                  448 
                  -
                  449 
                  -
                  450 #define __syncthreads() hc_barrier(CLK_LOCAL_MEM_FENCE)
                  -
                  451 
                  -
                  452 
                  -
                  453 #if 0
                  -
                  454 #define KALMAR_PFE_BEGIN() \
                  -
                  455  hc::extent<3> ext(lp.gridDim.x, lp.gridDim.y, lp.gridDim.z);\
                  -
                  456  auto __hipExtTile = ext.tile(lp.groupDim.x, lp.groupDim.y, lp.groupDim.z);\
                  -
                  457  __hipExtTile.set_dynamic_group_segment_size(lp.groupMemBytes);\
                  -
                  458  \
                  -
                  459  hc::completion_future cf = hc::parallel_for_each (\
                  -
                  460  *lp.av,\
                  -
                  461  __hipExtTile,\
                  -
                  462  [=] (hc::tiled_index<3> __hipIdx) mutable [[hc]]
                  -
                  463 
                  -
                  464 
                  -
                  465 
                  -
                  466 #define KALMAR_PFE_END \
                  -
                  467  ); \
                  -
                  468  if (HIP_LAUNCH_BLOCKING) {\
                  -
                  469  if (HIP_TRACE_API) {\
                  -
                  470  fprintf(stderr, "hiptrace1: HIP_LAUNCH_BLOCKING ...\n");\
                  -
                  471  }\
                  -
                  472  cf.wait(); \
                  -
                  473  if (HIP_TRACE_API) {\
                  -
                  474  fprintf(stderr, "hiptrace1: ...completed.\n");\
                  -
                  475  }\
                  -
                  476  }
                  -
                  477 #endif
                  -
                  478 
                  -
                  479 
                  -
                  480 
                  -
                  481 #define HIP_KERNEL_NAME(...) __VA_ARGS__
                  -
                  482 
                  -
                  483 
                  -
                  484 #ifdef __HCC_CPP__
                  -
                  485 hipStream_t ihipPreLaunchKernel(hipStream_t stream, hc::accelerator_view **av);
                  -
                  486 void ihipPostLaunchKernel(hipStream_t stream, hc::completion_future &cf);
                  -
                  487 
                  -
                  488 // TODO - move to common header file.
                  -
                  489 #define KNRM "\x1B[0m"
                  -
                  490 #define KGRN "\x1B[32m"
                  -
                  491 
                  -
                  492 #if not defined(DISABLE_GRID_LAUNCH)
                  -
                  493 #define hipLaunchKernel(_kernelName, _numBlocks3D, _blockDim3D, _groupMemBytes, _stream, ...) \
                  -
                  494 do {\
                  -
                  495  grid_launch_parm lp;\
                  -
                  496  lp.gridDim.x = _numBlocks3D.x; \
                  -
                  497  lp.gridDim.y = _numBlocks3D.y; \
                  -
                  498  lp.gridDim.z = _numBlocks3D.z; \
                  -
                  499  lp.groupDim.x = _blockDim3D.x; \
                  -
                  500  lp.groupDim.y = _blockDim3D.y; \
                  -
                  501  lp.groupDim.z = _blockDim3D.z; \
                  -
                  502  lp.groupMemBytes = _groupMemBytes;\
                  -
                  503  hc::completion_future cf;\
                  -
                  504  lp.cf = &cf; \
                  -
                  505  hipStream_t trueStream = (ihipPreLaunchKernel(_stream, &lp.av)); \
                  -
                  506  if (HIP_TRACE_API) {\
                  -
                  507  fprintf(stderr, KGRN "<<hip-api: hipLaunchKernel '%s' gridDim:[%d.%d.%d] groupDim:[%d.%d.%d] groupMem:+%d stream=%p\n" KNRM, \
                  -
                  508  #_kernelName, lp.gridDim.z, lp.gridDim.y, lp.gridDim.x, lp.groupDim.z, lp.groupDim.y, lp.groupDim.x, lp.groupMemBytes, (void*)(_stream));\
                  -
                  509  }\
                  -
                  510  _kernelName (lp, __VA_ARGS__);\
                  -
                  511  ihipPostLaunchKernel(trueStream, cf);\
                  -
                  512 } while(0)
                  -
                  513 
                  -
                  514 #else
                  -
                  515 #warning(DISABLE_GRID_LAUNCH set)
                  -
                  516 
                  -
                  517 #define hipLaunchKernel(_kernelName, _numBlocks3D, _blockDim3D, _groupMemBytes, _stream, ...) \
                  -
                  518 do {\
                  -
                  519  grid_launch_parm lp;\
                  -
                  520  lp.gridDim.x = _numBlocks3D.x * _blockDim3D.x;/*Convert from #blocks to #threads*/ \
                  -
                  521  lp.gridDim.y = _numBlocks3D.y * _blockDim3D.y;/*Convert from #blocks to #threads*/ \
                  -
                  522  lp.gridDim.z = _numBlocks3D.z * _blockDim3D.z;/*Convert from #blocks to #threads*/ \
                  -
                  523  lp.groupDim.x = _blockDim3D.x; \
                  -
                  524  lp.groupDim.y = _blockDim3D.y; \
                  -
                  525  lp.groupDim.z = _blockDim3D.z; \
                  -
                  526  lp.groupMemBytes = _groupMemBytes;\
                  -
                  527  hc::completion_future cf;\
                  -
                  528  lp.cf = &cf; \
                  -
                  529  hipStream_t trueStream = (ihipPreLaunchKernel(_stream, &lp.av)); \
                  -
                  530  if (HIP_TRACE_API) {\
                  -
                  531  fprintf(stderr, "==hip-api: launch '%s' gridDim:[%d.%d.%d] groupDim:[%d.%d.%d] groupMem:+%d stream=%p\n", \
                  -
                  532  #_kernelName, lp.gridDim.z, lp.gridDim.y, lp.gridDim.x, lp.groupDim.z, lp.groupDim.y, lp.groupDim.x, lp.groupMemBytes, (void*)(_stream));\
                  -
                  533  }\
                  -
                  534  _kernelName (lp, __VA_ARGS__);\
                  -
                  535  ihipPostLaunchKernel(trueStream, cf);\
                  -
                  536 } while(0)
                  -
                  537 /*end hipLaunchKernel */
                  -
                  538 #endif
                  -
                  539 
                  -
                  540 #elif defined (__HCC_C__)
                  -
                  541 
                  -
                  542 //TODO - develop C interface.
                  -
                  543 
                  -
                  544 #endif
                  -
                  545 
                  -
                  546 
                  -
                  547 #if not defined(DISABLE_GRID_LAUNCH)
                  -
                  548 // TODO -In GL these are no-ops and can be removed:
                  -
                  549 // Keep them around for a little while as a fallback.
                  -
                  550 #define KERNELBEGIN
                  -
                  551 #define KERNELEND
                  +
                  384 // integer intrinsic function __poc __clz __ffs __brev
                  +
                  385 __device__ unsigned int __popc( unsigned int input);
                  +
                  386 __device__ unsigned int __popcll( unsigned long long int input);
                  +
                  387 __device__ unsigned int __clz(unsigned int input);
                  +
                  388 __device__ unsigned int __clzll(unsigned long long int input);
                  +
                  389 __device__ unsigned int __clz(int input);
                  +
                  390 __device__ unsigned int __clzll(long long int input);
                  +
                  391 __device__ unsigned int __ffs(unsigned int input);
                  +
                  392 __device__ unsigned int __ffsll(unsigned long long int input);
                  +
                  393 __device__ unsigned int __ffs(int input);
                  +
                  394 __device__ unsigned int __ffsll(long long int input);
                  +
                  395 __device__ unsigned int __brev( unsigned int input);
                  +
                  396 __device__ unsigned long long int __brevll( unsigned long long int input);
                  +
                  397 
                  +
                  398 
                  +
                  399 // warp vote function __all __any __ballot
                  +
                  400 __device__ int __all( int input);
                  +
                  401 __device__ int __any( int input);
                  +
                  402 __device__ unsigned long long int __ballot( int input);
                  +
                  403 
                  +
                  404 // warp shuffle functions
                  +
                  405 #ifdef __cplusplus
                  +
                  406 
                  +
                  407 __device__ int __shfl(int input, int lane, int width=warpSize);
                  +
                  408 __device__ int __shfl_up(int input, unsigned int lane_delta, int width=warpSize);
                  +
                  409 __device__ int __shfl_down(int input, unsigned int lane_delta, int width=warpSize);
                  +
                  410 __device__ int __shfl_xor(int input, int lane_mask, int width=warpSize);
                  +
                  411 __device__ float __shfl(float input, int lane, int width=warpSize);
                  +
                  412 __device__ float __shfl_up(float input, unsigned int lane_delta, int width=warpSize);
                  +
                  413 __device__ float __shfl_down(float input, unsigned int lane_delta, int width=warpSize);
                  +
                  414 __device__ float __shfl_xor(float input, int lane_mask, int width=warpSize);
                  +
                  415 #else
                  +
                  416 __device__ int __shfl(int input, int lane, int width);
                  +
                  417 __device__ int __shfl_up(int input, unsigned int lane_delta, int width);
                  +
                  418 __device__ int __shfl_down(int input, unsigned int lane_delta, int width);
                  +
                  419 __device__ int __shfl_xor(int input, int lane_mask, int width);
                  +
                  420 __device__ float __shfl(float input, int lane, int width);
                  +
                  421 __device__ float __shfl_up(float input, unsigned int lane_delta, int width);
                  +
                  422 __device__ float __shfl_down(float input, unsigned int lane_delta, int width);
                  +
                  423 __device__ float __shfl_xor(float input, int lane_mask, int width);
                  +
                  424 #endif
                  +
                  425 
                  +
                  426 __host__ __device__ int min(int arg1, int arg2);
                  +
                  427 __host__ __device__ int max(int arg1, int arg2);
                  +
                  428 
                  +
                  429 //TODO - add a couple fast math operations here, the set here will grow :
                  +
                  430 __device__ float __cosf(float x);
                  +
                  431 __device__ float __expf(float x);
                  +
                  432 __device__ float __frsqrt_rn(float x);
                  +
                  433 __device__ float __fsqrt_rd(float x);
                  +
                  434 __device__ float __fsqrt_rn(float x);
                  +
                  435 __device__ float __fsqrt_ru(float x);
                  +
                  436 __device__ float __fsqrt_rz(float x);
                  +
                  437 __device__ float __log10f(float x);
                  +
                  438 __device__ float __log2f(float x);
                  +
                  439 __device__ float __logf(float x);
                  +
                  440 __device__ float __powf(float base, float exponent);
                  +
                  441 __device__ void __sincosf(float x, float *s, float *c) ;
                  +
                  442 __device__ float __sinf(float x);
                  +
                  443 __device__ float __tanf(float x);
                  +
                  444 __device__ float __dsqrt_rd(double x);
                  +
                  445 __device__ float __dsqrt_rn(double x);
                  +
                  446 __device__ float __dsqrt_ru(double x);
                  +
                  447 __device__ float __dsqrt_rz(double x);
                  +
                  448 #endif
                  +
                  449 
                  +
                  453 #if __hcc_workweek__ >= 16123
                  +
                  454 
                  +
                  455 #define hipThreadIdx_x (amp_get_local_id(0))
                  +
                  456 #define hipThreadIdx_y (amp_get_local_id(1))
                  +
                  457 #define hipThreadIdx_z (amp_get_local_id(2))
                  +
                  458 
                  +
                  459 #define hipBlockIdx_x (hc_get_group_id(0))
                  +
                  460 #define hipBlockIdx_y (hc_get_group_id(1))
                  +
                  461 #define hipBlockIdx_z (hc_get_group_id(2))
                  +
                  462 
                  +
                  463 #define hipBlockDim_x (amp_get_local_size(0))
                  +
                  464 #define hipBlockDim_y (amp_get_local_size(1))
                  +
                  465 #define hipBlockDim_z (amp_get_local_size(2))
                  +
                  466 
                  +
                  467 #define hipGridDim_x (hc_get_num_groups(0))
                  +
                  468 #define hipGridDim_y (hc_get_num_groups(1))
                  +
                  469 #define hipGridDim_z (hc_get_num_groups(2))
                  +
                  470 
                  +
                  471 #else
                  +
                  472 
                  +
                  473 #define hipThreadIdx_x (amp_get_local_id(2))
                  +
                  474 #define hipThreadIdx_y (amp_get_local_id(1))
                  +
                  475 #define hipThreadIdx_z (amp_get_local_id(0))
                  +
                  476 
                  +
                  477 #define hipBlockIdx_x (hc_get_group_id(2))
                  +
                  478 #define hipBlockIdx_y (hc_get_group_id(1))
                  +
                  479 #define hipBlockIdx_z (hc_get_group_id(0))
                  +
                  480 
                  +
                  481 #define hipBlockDim_x (amp_get_local_size(2))
                  +
                  482 #define hipBlockDim_y (amp_get_local_size(1))
                  +
                  483 #define hipBlockDim_z (amp_get_local_size(0))
                  +
                  484 
                  +
                  485 #define hipGridDim_x (hc_get_num_groups(2))
                  +
                  486 #define hipGridDim_y (hc_get_num_groups(1))
                  +
                  487 #define hipGridDim_z (hc_get_num_groups(0))
                  +
                  488 
                  +
                  489 #endif
                  +
                  490 
                  +
                  491 #define __syncthreads() hc_barrier(CLK_LOCAL_MEM_FENCE)
                  +
                  492 
                  +
                  493 #define HIP_KERNEL_NAME(...) __VA_ARGS__
                  +
                  494 
                  +
                  495 #ifdef __HCC_CPP__
                  +
                  496 hipStream_t ihipPreLaunchKernel(hipStream_t stream, hc::accelerator_view **av);
                  +
                  497 void ihipPostLaunchKernel(hipStream_t stream, hc::completion_future &cf);
                  +
                  498 
                  +
                  499 // TODO - move to common header file.
                  +
                  500 #define KNRM "\x1B[0m"
                  +
                  501 #define KGRN "\x1B[32m"
                  +
                  502 
                  +
                  503 #if not defined(DISABLE_GRID_LAUNCH)
                  +
                  504 #define hipLaunchKernel(_kernelName, _numBlocks3D, _blockDim3D, _groupMemBytes, _stream, ...) \
                  +
                  505 do {\
                  +
                  506  grid_launch_parm lp;\
                  +
                  507  lp.gridDim.x = _numBlocks3D.x; \
                  +
                  508  lp.gridDim.y = _numBlocks3D.y; \
                  +
                  509  lp.gridDim.z = _numBlocks3D.z; \
                  +
                  510  lp.groupDim.x = _blockDim3D.x; \
                  +
                  511  lp.groupDim.y = _blockDim3D.y; \
                  +
                  512  lp.groupDim.z = _blockDim3D.z; \
                  +
                  513  lp.groupMemBytes = _groupMemBytes;\
                  +
                  514  hc::completion_future cf;\
                  +
                  515  lp.cf = &cf; \
                  +
                  516  hipStream_t trueStream = (ihipPreLaunchKernel(_stream, &lp.av)); \
                  +
                  517  if (HIP_TRACE_API) {\
                  +
                  518  fprintf(stderr, KGRN "<<hip-api: hipLaunchKernel '%s' gridDim:[%d.%d.%d] groupDim:[%d.%d.%d] groupMem:+%d stream=%p\n" KNRM, \
                  +
                  519  #_kernelName, lp.gridDim.z, lp.gridDim.y, lp.gridDim.x, lp.groupDim.z, lp.groupDim.y, lp.groupDim.x, lp.groupMemBytes, (void*)(_stream));\
                  +
                  520  }\
                  +
                  521  _kernelName (lp, __VA_ARGS__);\
                  +
                  522  ihipPostLaunchKernel(trueStream, cf);\
                  +
                  523 } while(0)
                  +
                  524 
                  +
                  525 #else
                  +
                  526 #warning(DISABLE_GRID_LAUNCH set)
                  +
                  527 
                  +
                  528 #define hipLaunchKernel(_kernelName, _numBlocks3D, _blockDim3D, _groupMemBytes, _stream, ...) \
                  +
                  529 do {\
                  +
                  530  grid_launch_parm lp;\
                  +
                  531  lp.gridDim.x = _numBlocks3D.x * _blockDim3D.x;/*Convert from #blocks to #threads*/ \
                  +
                  532  lp.gridDim.y = _numBlocks3D.y * _blockDim3D.y;/*Convert from #blocks to #threads*/ \
                  +
                  533  lp.gridDim.z = _numBlocks3D.z * _blockDim3D.z;/*Convert from #blocks to #threads*/ \
                  +
                  534  lp.groupDim.x = _blockDim3D.x; \
                  +
                  535  lp.groupDim.y = _blockDim3D.y; \
                  +
                  536  lp.groupDim.z = _blockDim3D.z; \
                  +
                  537  lp.groupMemBytes = _groupMemBytes;\
                  +
                  538  hc::completion_future cf;\
                  +
                  539  lp.cf = &cf; \
                  +
                  540  hipStream_t trueStream = (ihipPreLaunchKernel(_stream, &lp.av)); \
                  +
                  541  if (HIP_TRACE_API) {\
                  +
                  542  fprintf(stderr, "==hip-api: launch '%s' gridDim:[%d.%d.%d] groupDim:[%d.%d.%d] groupMem:+%d stream=%p\n", \
                  +
                  543  #_kernelName, lp.gridDim.z, lp.gridDim.y, lp.gridDim.x, lp.groupDim.z, lp.groupDim.y, lp.groupDim.x, lp.groupMemBytes, (void*)(_stream));\
                  +
                  544  }\
                  +
                  545  _kernelName (lp, __VA_ARGS__);\
                  +
                  546  ihipPostLaunchKernel(trueStream, cf);\
                  +
                  547 } while(0)
                  +
                  548 /*end hipLaunchKernel */
                  +
                  549 #endif
                  +
                  550 
                  +
                  551 #elif defined (__HCC_C__)
                  552 
                  -
                  553 #else
                  -
                  554 
                  -
                  555 // TODO-GL:
                  -
                  556 // These wrap the kernel in a PFE loop with macros.
                  -
                  557 // Not required with GL but exist here as a fallback.
                  -
                  558 #define KERNELBEGIN \
                  -
                  559  hc::extent<3> ext(lp.gridDim.x, lp.gridDim.y, lp.gridDim.z);\
                  -
                  560  auto __hipExtTile = ext.tile(lp.groupDim.x, lp.groupDim.y, lp.groupDim.z);\
                  -
                  561  __hipExtTile.set_dynamic_group_segment_size(lp.groupMemBytes);\
                  -
                  562  \
                  -
                  563  hc::completion_future cf = \
                  -
                  564  hc::parallel_for_each (\
                  -
                  565  *lp.av,\
                  -
                  566  __hipExtTile,\
                  -
                  567  [=] (hc::tiled_index<3> __hipIdx) mutable [[hc]] \
                  -
                  568  {
                  -
                  569 
                  -
                  570 
                  -
                  571 #define KERNELEND \
                  -
                  572  }); \
                  -
                  573  if (HIP_LAUNCH_BLOCKING) {\
                  -
                  574  if (HIP_TRACE_API) {\
                  -
                  575  fprintf(stderr, "hiptrace1: HIP_LAUNCH_BLOCKING ...\n");\
                  -
                  576  }\
                  -
                  577  cf.wait(); \
                  -
                  578  if (HIP_TRACE_API) {\
                  -
                  579  fprintf(stderr, "hiptrace1: ...completed.\n");\
                  -
                  580  }\
                  -
                  581  }
                  -
                  582 
                  -
                  583 #endif /*DISABLE_GRID_LAUNCH*/
                  -
                  584 
                  -
                  585 
                  -
                  586 #endif // __HCC__
                  -
                  587 
                  -
                  588 
                  -
                  593 extern int HIP_PRINT_ENV ;
                  -
                  594 extern int HIP_TRACE_API;
                  -
                  595 extern int HIP_LAUNCH_BLOCKING ;
                  -
                  596 
                  -
                  602 // End doxygen API:
                  -
                  int HIP_TRACE_API
                  Trace HIP APIs.
                  Definition: hip_hcc.cpp:73
                  +
                  553 //TODO - develop C interface.
                  +
                  554 
                  +
                  555 #endif
                  +
                  556 
                  +
                  557 #endif // __HCC__
                  +
                  558 
                  +
                  559 
                  +
                  564 //extern int HIP_PRINT_ENV ; ///< Print all HIP-related environment variables.
                  +
                  565 //extern int HIP_TRACE_API; ///< Trace HIP APIs.
                  +
                  566 //extern int HIP_LAUNCH_BLOCKING ; ///< Make all HIP APIs host-synchronous
                  +
                  567 
                  +
                  573 // End doxygen API:
                  +
                  579 #endif
                  TODO-doc.
                  +
                  #define __host__
                  Definition: host_defines.h:35
                  HIP C++ Texture API for hcc compiler.
                  -
                  int HIP_PRINT_ENV
                  Print all HIP-related environment variables.
                  Definition: hip_hcc.cpp:72
                  Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
                  -
                  int HIP_LAUNCH_BLOCKING
                  Make all HIP APIs host-synchronous.
                  Definition: hip_hcc.cpp:70
                  diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h.html b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h.html index eb2140c4e5..a8fc9f8a60 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/hip_runtime_api.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_runtime_api.h File Reference @@ -101,16 +101,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  #include <stdint.h>
                  #include <stddef.h>
                  #include <hcc_detail/host_defines.h>
                  -#include <hc.hpp>
                  +#include <hip_runtime_api.h>

                  Go to the source code of this file.

                  - - + +

                  Classes

                  struct  dim3
                   
                  struct  hipEvent_t
                   
                  struct  dim3
                   
                  @@ -163,21 +163,41 @@ Macros #define  + + + + + + + + + + + +

                  Macros

                  hipHostRegisterIoMemory   0x4
                   Not supported.
                   
                  +#define hipDeviceScheduleAuto   0x0
                   
                  +#define hipDeviceScheduleSpin   0x1
                   
                  +#define hipDeviceScheduleYield   0x2
                   
                  +#define hipDeviceBlockingSync   0x4
                   
                  +#define hipDeviceMapHost   0x8
                   
                  +#define hipDeviceLmemResizeToMax   0x16
                   
                  + + + + - - - - + +

                  Typedefs

                  +typedef struct ihipStream_thipStream_t
                   
                  +typedef struct hipEvent_t hipEvent_t
                   
                  typedef enum hipFuncCache hipFuncCache
                   
                  typedef enum hipSharedMemConfig hipSharedMemConfig
                   
                  typedef struct dim3 dim3
                   
                  -typedef class ihipStream_thipStream_t
                   
                  -typedef struct hipEvent_t hipEvent_t
                   
                  typedef enum hipMemcpyKind hipMemcpyKind
                   
                  @@ -241,6 +261,9 @@ Functions + + + @@ -256,6 +279,9 @@ Functions + + + @@ -271,9 +297,11 @@ Functions - - - + + + + + @@ -328,49 +356,43 @@ Functions - - - + + + - - - + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - -

                  Enumerations

                  hipError_t hipDeviceSetSharedMemConfig (hipSharedMemConfig config)
                   Set Shared memory bank configuration. More...
                   
                  hipError_t hipSetDeviceFlags (unsigned flags)
                   Set Device flags. More...
                   
                  hipError_t hipGetLastError (void)
                   Return last error returned by any HIP runtime API call and resets the stored error code to hipSuccess. More...
                   
                  hipError_t hipStreamCreateWithFlags (hipStream_t *stream, unsigned int flags)
                   Create an asynchronous stream. More...
                   
                  hipError_t hipStreamCreate (hipStream_t *stream)
                   Create an asynchronous stream. More...
                   
                  hipError_t hipStreamWaitEvent (hipStream_t stream, hipEvent_t event, unsigned int flags)
                   Make the specified compute stream wait for an event. More...
                   
                  hipError_t hipEventCreateWithFlags (hipEvent_t *event, unsigned flags)
                   Create an event with the specified flags. More...
                   
                  hipError_t hipEventRecord (hipEvent_t event, hipStream_t stream=NULL)
                   Record an event in the specified stream. More...
                   
                  hipError_t hipEventCreate (hipEvent_t *event)
                   
                  hipError_t hipEventRecord (hipEvent_t event, hipStream_t stream)
                   Record an event in the specified stream. More...
                   
                  hipError_t hipEventDestroy (hipEvent_t event)
                   Destroy the specified event. More...
                   
                  hipError_t hipMemcpyToSymbol (const char *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind)
                   Copies sizeBytes bytes from the memory area pointed to by src to the memory area pointed to by offset bytes from the start of symbol symbol. More...
                   
                  hipError_t hipMemcpyAsync (void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream=0)
                   Copy data from src to dst asynchronously. More...
                   
                  hipError_t hipMemcpyAsync (void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream)
                   Copy data from src to dst asynchronously. More...
                   
                  hipError_t hipMemset (void *dst, int value, size_t sizeBytes)
                   Copy data from src to dst asynchronously. More...
                   
                  hipError_t hipMemsetAsync (void *dst, int value, size_t sizeBytes, hipStream_t=0)
                   Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value value. More...
                   
                  hipError_t hipMemsetAsync (void *dst, int value, size_t sizeBytes, hipStream_t stream)
                   Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value value. More...
                   
                  hipError_t hipMemGetInfo (size_t *free, size_t *total)
                   Query memory info. Return snapshot of free memory, and total allocatable memory on the device. More...
                   
                  hipError_t hipDeviceCanAccessPeer (int *canAccessPeer, int device, int peerDevice)
                   Determine if a device can access a peer's memory. More...
                   
                  hipError_t hipDeviceDisablePeerAccess (int peerDevice)
                   Disables registering memory on peerDevice for direct access from the current device. More...
                   
                  hipError_t hipDeviceEnablePeerAccess (int peerDevice, unsigned int flags)
                   Enables registering memory on peerDevice for direct access from the current device. More...
                   
                  hipError_t hipMemcpyPeer (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes)
                   Copies memory from one device to memory on another device. More...
                   
                  hipError_t hipMemcpyPeerAsync (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream=0)
                   Copies memory from one device to memory on another device. More...
                   
                  hipError_t hipDeviceCanAccessPeer (int *canAccessPeer, int deviceId, int peerDeviceId)
                   Determine if a device can access a peer's memory. More...
                   
                  hipError_t hipDeviceEnablePeerAccess (int peerDeviceId, unsigned int flags)
                   Enable direct access from current device's virtual address space to memory allocations physically located on a peer device. More...
                   
                  hipError_t hipDeviceDisablePeerAccess (int peerDeviceId)
                   Disable direct access from current device's virtual address space to memory allocations physically located on a peer device. More...
                   
                  hipError_t hipMemcpyPeer (void *dst, int dstDeviceId, const void *src, int srcDeviceId, size_t sizeBytes)
                   Copies memory from one device to memory on another device. More...
                   
                  hipError_t hipMemcpyPeerAsync (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream)
                   Copies memory from one device to memory on another device. More...
                   
                  hipError_t hipDriverGetVersion (int *driverVersion)
                   Returns the approximate HIP driver version. More...
                   
                  hipError_t hipHccGetAccelerator (int deviceId, hc::accelerator *acc)
                   Return hc::accelerator associated with the specified deviceId. More...
                   
                  hipError_t hipHccGetAcceleratorView (hipStream_t stream, hc::accelerator_view **av)
                   Return hc::accelerator_view associated with the specified stream. More...
                   

                  Detailed Description

                  Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language extensions (-hc mode) ; those functions in hip_runtime.h.

                  diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h_source.html b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h_source.html index b194fa5b33..51e0670d7f 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h_source.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/hip_runtime_api.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_runtime_api.h Source File @@ -110,381 +110,389 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
                  20 THE SOFTWARE.
                  21 */
                  -
                  22 #pragma once
                  -
                  23 
                  -
                  29 #include <stdint.h>
                  -
                  30 #include <stddef.h>
                  -
                  31 
                  - -
                  33 
                  -
                  34 #if defined (__HCC__) && (__hcc_workweek__ < 1602)
                  -
                  35 #error("This version of HIP requires a newer version of HCC.");
                  -
                  36 #endif
                  -
                  37 
                  -
                  38 // Structure definitions:
                  -
                  39 #ifdef __cplusplus
                  -
                  40 extern "C" {
                  -
                  41 #endif
                  -
                  42 
                  -
                  47 #define hipStreamDefault 0x00
                  -
                  49 #define hipStreamNonBlocking 0x01
                  -
                  50 
                  -
                  51 
                  -
                  53 #define hipEventDefault 0x0
                  -
                  54 #define hipEventBlockingSync 0x1
                  -
                  55 #define hipEventDisableTiming 0x2
                  -
                  56 #define hipEventInterprocess 0x4
                  -
                  57 
                  -
                  58 
                  -
                  60 #define hipHostMallocDefault 0x0
                  -
                  61 #define hipHostMallocPortable 0x1
                  -
                  62 #define hipHostMallocMapped 0x2
                  -
                  63 #define hipHostMallocWriteCombined 0x4
                  -
                  64 
                  -
                  66 #define hipHostRegisterDefault 0x0
                  -
                  67 #define hipHostRegisterPortable 0x1
                  -
                  68 #define hipHostRegisterMapped 0x2
                  -
                  69 #define hipHostRegisterIoMemory 0x4
                  -
                  70 
                  -
                  71 
                  -
                  74 typedef enum hipFuncCache {
                  - - - - -
                  79 } hipFuncCache;
                  -
                  80 
                  -
                  81 
                  -
                  85 typedef enum hipSharedMemConfig {
                  - - - - -
                  90 
                  -
                  91 
                  -
                  92 
                  -
                  97 typedef struct dim3 {
                  -
                  98  uint32_t x;
                  -
                  99  uint32_t y;
                  -
                  100  uint32_t z;
                  -
                  101 
                  -
                  102  dim3(uint32_t _x=1, uint32_t _y=1, uint32_t _z=1) : x(_x), y(_y), z(_z) {};
                  -
                  103 } dim3;
                  -
                  104 
                  -
                  105 
                  -
                  106 
                  - - - - - - -
                  117 } ;
                  -
                  118 
                  -
                  119 
                  -
                  120 
                  -
                  121 
                  -
                  122 // Doxygen end group GlobalDefs
                  -
                  126 //-------------------------------------------------------------------------------------------------
                  -
                  127 
                  -
                  128 
                  -
                  129 // The handle allows the async commands to use the stream even if the parent hipStream_t goes out-of-scope.
                  -
                  130 typedef class ihipStream_t * hipStream_t;
                  -
                  131 
                  -
                  132 
                  -
                  133 /*
                  -
                  134  * Opaque structure allows the true event (pointed at by the handle) to remain "live" even if the surrounding hipEvent_t goes out-of-scope.
                  -
                  135  * This is handy for cases where the hipEvent_t goes out-of-scope but the true event is being written by some async queue or device */
                  -
                  136 typedef struct hipEvent_t {
                  -
                  137  struct ihipEvent_t *_handle;
                  -
                  138 } hipEvent_t;
                  +
                  22 //#pragma once
                  +
                  23 #ifndef HIP_RUNTIME_API_H
                  +
                  24 #define HIP_RUNTIME_API_H
                  +
                  25 
                  +
                  30 #include <stdint.h>
                  +
                  31 #include <stddef.h>
                  +
                  32 
                  + +
                  34 #include <hip_runtime_api.h>
                  +
                  35 //#include "hip_hcc.h"
                  +
                  36 
                  +
                  37 #if defined (__HCC__) && (__hcc_workweek__ < 16155)
                  +
                  38 #error("This version of HIP requires a newer version of HCC.");
                  +
                  39 #endif
                  +
                  40 
                  +
                  41 // Structure definitions:
                  +
                  42 #ifdef __cplusplus
                  +
                  43 extern "C" {
                  +
                  44 #endif
                  +
                  45 
                  +
                  46 typedef struct ihipStream_t *hipStream_t;
                  +
                  47 typedef struct hipEvent_t {
                  +
                  48  struct ihipEvent_t *_handle;
                  +
                  49 } hipEvent_t;
                  +
                  50 
                  +
                  51 
                  +
                  56 #define hipStreamDefault 0x00
                  +
                  58 #define hipStreamNonBlocking 0x01
                  +
                  59 
                  +
                  60 
                  +
                  62 #define hipEventDefault 0x0
                  +
                  63 #define hipEventBlockingSync 0x1
                  +
                  64 #define hipEventDisableTiming 0x2
                  +
                  65 #define hipEventInterprocess 0x4
                  +
                  66 
                  +
                  67 
                  +
                  69 #define hipHostMallocDefault 0x0
                  +
                  70 #define hipHostMallocPortable 0x1
                  +
                  71 #define hipHostMallocMapped 0x2
                  +
                  72 #define hipHostMallocWriteCombined 0x4
                  +
                  73 
                  +
                  75 #define hipHostRegisterDefault 0x0
                  +
                  76 #define hipHostRegisterPortable 0x1
                  +
                  77 #define hipHostRegisterMapped 0x2
                  +
                  78 #define hipHostRegisterIoMemory 0x4
                  +
                  79 
                  +
                  80 
                  +
                  81 #define hipDeviceScheduleAuto 0x0
                  +
                  82 #define hipDeviceScheduleSpin 0x1
                  +
                  83 #define hipDeviceScheduleYield 0x2
                  +
                  84 #define hipDeviceBlockingSync 0x4
                  +
                  85 #define hipDeviceMapHost 0x8
                  +
                  86 #define hipDeviceLmemResizeToMax 0x16
                  +
                  87 
                  +
                  91 typedef enum hipFuncCache {
                  + + + + +
                  96 } hipFuncCache;
                  +
                  97 
                  +
                  98 
                  +
                  102 typedef enum hipSharedMemConfig {
                  + + + + +
                  107 
                  +
                  108 
                  +
                  109 
                  +
                  114 typedef struct dim3 {
                  +
                  115  uint32_t x;
                  +
                  116  uint32_t y;
                  +
                  117  uint32_t z;
                  +
                  118 #ifdef __cplusplus
                  +
                  119  dim3(uint32_t _x=1, uint32_t _y=1, uint32_t _z=1) : x(_x), y(_y), z(_z) {};
                  +
                  120 #endif
                  +
                  121 } dim3;
                  +
                  122 
                  +
                  123 
                  +
                  124 
                  +
                  129 typedef enum hipMemcpyKind {
                  + + + + + +
                  135 } hipMemcpyKind;
                  +
                  136 
                  +
                  137 
                  +
                  138 
                  139 
                  -
                  140 
                  -
                  141 
                  -
                  142 
                  -
                  143 
                  -
                  144 
                  +
                  140 // Doxygen end group GlobalDefs
                  +
                  144 //-------------------------------------------------------------------------------------------------
                  145 
                  -
                  146 #ifdef __cplusplus
                  -
                  147 } /* extern "C" */
                  -
                  148 #endif
                  -
                  149 
                  +
                  146 
                  +
                  147 // The handle allows the async commands to use the stream even if the parent hipStream_t goes out-of-scope.
                  +
                  148 //typedef class ihipStream_t * hipStream_t;
                  +
                  149 
                  150 
                  -
                  151 
                  -
                  152 
                  -
                  153 //==================================================================================================
                  -
                  154 #ifdef __cplusplus
                  -
                  155 extern "C" {
                  -
                  156 #endif
                  -
                  157 
                  - -
                  182 
                  -
                  183 
                  -
                  184 
                  - -
                  196 
                  -
                  197 
                  -
                  222 hipError_t hipSetDevice(int device);
                  -
                  223 
                  -
                  224 
                  -
                  236 hipError_t hipGetDevice(int *device);
                  -
                  237 
                  -
                  238 
                  -
                  246 hipError_t hipGetDeviceCount(int *count);
                  -
                  247 
                  -
                  254 hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device);
                  -
                  255 
                  - -
                  265 
                  -
                  266 
                  -
                  267 
                  -
                  268 //Cache partitioning functions:
                  -
                  269 
                  - -
                  277 
                  -
                  278 
                  - -
                  286 
                  -
                  287 
                  - -
                  295 
                  -
                  296 //---
                  -
                  297 //Shared bank config functions:
                  -
                  298 
                  - -
                  306 
                  -
                  307 
                  - -
                  315 
                  -
                  316 
                  -
                  317 // end doxygen Device
                  - -
                  338 
                  -
                  339 
                  - +
                  151 /*
                  +
                  152  * Opaque structure allows the true event (pointed at by the handle) to remain "live" even if the surrounding hipEvent_t goes out-of-scope.
                  +
                  153  * This is handy for cases where the hipEvent_t goes out-of-scope but the true event is being written by some async queue or device */
                  +
                  154 //typedef struct hipEvent_t {
                  +
                  155 // struct ihipEvent_t *_handle;
                  +
                  156 //} hipEvent_t;
                  +
                  157 
                  +
                  158 
                  +
                  159 
                  +
                  160 
                  +
                  161 
                  +
                  162 
                  +
                  163 
                  + +
                  188 
                  +
                  189 
                  +
                  190 
                  + +
                  202 
                  +
                  203 
                  +
                  228 hipError_t hipSetDevice(int device);
                  +
                  229 
                  +
                  230 
                  +
                  242 hipError_t hipGetDevice(int *device);
                  +
                  243 
                  +
                  244 
                  +
                  252 hipError_t hipGetDeviceCount(int *count);
                  +
                  253 
                  +
                  260 hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device);
                  +
                  261 
                  + +
                  271 
                  +
                  272 
                  +
                  273 
                  +
                  274 //Cache partitioning functions:
                  +
                  275 
                  + +
                  283 
                  +
                  284 
                  + +
                  292 
                  +
                  293 
                  + +
                  301 
                  +
                  302 //---
                  +
                  303 //Shared bank config functions:
                  +
                  304 
                  + +
                  312 
                  +
                  313 
                  + +
                  321 
                  +
                  328 hipError_t hipSetDeviceFlags ( unsigned flags);
                  +
                  329 
                  +
                  330 // end doxygen Device
                  + +
                  351 
                  352 
                  -
                  353 
                  -
                  354 
                  -
                  363 const char *hipGetErrorName(hipError_t hip_error);
                  -
                  364 
                  +
                  365 
                  -
                  376 const char *hipGetErrorString(hipError_t hip_error);
                  +
                  366 
                  +
                  367 
                  +
                  376 const char *hipGetErrorName(hipError_t hip_error);
                  377 
                  -
                  378 // end doxygen Error
                  -
                  411 hipError_t hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags);
                  -
                  412 
                  -
                  413 
                  -
                  414 
                  -
                  429 static inline hipError_t hipStreamCreate(hipStream_t *stream)
                  -
                  430 {
                  - -
                  432 }
                  -
                  433 
                  -
                  434 
                  -
                  450 hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags);
                  -
                  451 
                  -
                  452 
                  -
                  464 hipError_t hipStreamSynchronize(hipStream_t stream);
                  -
                  465 
                  -
                  466 
                  -
                  480 hipError_t hipStreamDestroy(hipStream_t stream);
                  -
                  481 
                  -
                  482 
                  -
                  496 hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags);
                  -
                  497 
                  -
                  498 
                  -
                  499 // end doxygen Stream
                  -
                  524 hipError_t hipEventCreateWithFlags(hipEvent_t* event, unsigned flags);
                  -
                  525 
                  -
                  526 
                  -
                  533 static inline hipError_t hipEventCreate(hipEvent_t* event)
                  -
                  534 {
                  -
                  535  return hipEventCreateWithFlags(event, 0);
                  -
                  536 }
                  -
                  537 
                  -
                  538 
                  -
                  564 hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream = NULL);
                  -
                  565 
                  -
                  566 
                  - -
                  578 
                  -
                  579 
                  - -
                  594 
                  -
                  595 
                  -
                  620 hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop);
                  -
                  621 
                  -
                  622 
                  - -
                  636 
                  -
                  637 
                  -
                  638 // end doxygen Events
                  - -
                  664 
                  -
                  665 
                  -
                  673 hipError_t hipMalloc(void** ptr, size_t size) ;
                  -
                  674 
                  -
                  675 
                  -
                  683 hipError_t hipMallocHost(void** ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead"))) ;
                  -
                  684 
                  -
                  693 hipError_t hipHostMalloc(void** ptr, size_t size, unsigned int flags) ;
                  -
                  694 hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags) __attribute__((deprecated("use hipHostMalloc instead"))) ;;
                  -
                  695 
                  -
                  704 hipError_t hipHostGetDevicePointer(void** devPtr, void* hstPtr, unsigned int flags) ;
                  -
                  705 
                  -
                  713 hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) ;
                  -
                  714 
                  -
                  745 hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) ;
                  -
                  746 
                  -
                  753 hipError_t hipHostUnregister(void* hostPtr) ;
                  +
                  378 
                  +
                  389 const char *hipGetErrorString(hipError_t hip_error);
                  +
                  390 
                  +
                  391 // end doxygen Error
                  +
                  424 hipError_t hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags);
                  +
                  425 
                  +
                  426 
                  +
                  427 
                  +
                  442 hipError_t hipStreamCreate(hipStream_t *stream);
                  +
                  443 
                  +
                  444 
                  +
                  460 hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags);
                  +
                  461 
                  +
                  462 
                  +
                  474 hipError_t hipStreamSynchronize(hipStream_t stream);
                  +
                  475 
                  +
                  476 
                  +
                  490 hipError_t hipStreamDestroy(hipStream_t stream);
                  +
                  491 
                  +
                  492 
                  +
                  506 hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags);
                  +
                  507 
                  +
                  508 
                  +
                  509 // end doxygen Stream
                  +
                  534 hipError_t hipEventCreateWithFlags(hipEvent_t* event, unsigned flags);
                  +
                  535 
                  +
                  536 
                  + +
                  544 
                  +
                  545 
                  +
                  570 #ifdef __cplusplus
                  +
                  571 hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream = NULL);
                  +
                  572 #else
                  +
                  573 hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream);
                  +
                  574 #endif
                  +
                  575 
                  + +
                  587 
                  +
                  588 
                  + +
                  603 
                  +
                  604 
                  +
                  629 hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop);
                  +
                  630 
                  +
                  631 
                  + +
                  645 
                  +
                  646 
                  +
                  647 // end doxygen Events
                  + +
                  673 
                  +
                  681 hipError_t hipMalloc(void** ptr, size_t size) ;
                  +
                  682 
                  +
                  683 
                  +
                  691 hipError_t hipMallocHost(void** ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead"))) ;
                  +
                  692 
                  +
                  701 hipError_t hipHostMalloc(void** ptr, size_t size, unsigned int flags) ;
                  +
                  702 hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags) __attribute__((deprecated("use hipHostMalloc instead"))) ;;
                  +
                  703 
                  +
                  712 hipError_t hipHostGetDevicePointer(void** devPtr, void* hstPtr, unsigned int flags) ;
                  +
                  713 
                  +
                  721 hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) ;
                  +
                  722 
                  +
                  753 hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) ;
                  754 
                  -
                  755 
                  -
                  763 hipError_t hipFree(void* ptr);
                  -
                  764 
                  -
                  765 
                  -
                  766 
                  -
                  773 hipError_t hipFreeHost(void* ptr) __attribute__((deprecated("use hipHostFree instead"))) ;
                  +
                  761 hipError_t hipHostUnregister(void* hostPtr) ;
                  +
                  762 
                  +
                  763 
                  +
                  771 hipError_t hipFree(void* ptr);
                  +
                  772 
                  +
                  773 
                  774 
                  -
                  775 
                  -
                  782 hipError_t hipHostFree(void* ptr);
                  +
                  781 hipError_t hipFreeHost(void* ptr) __attribute__((deprecated("use hipHostFree instead"))) ;
                  +
                  782 
                  783 
                  -
                  784 
                  -
                  785 
                  -
                  799 hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind);
                  -
                  800 
                  -
                  801 
                  -
                  816 hipError_t hipMemcpyToSymbol(const char* symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind);
                  -
                  817 
                  -
                  818 
                  -
                  831 hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream=0);
                  -
                  832 
                  -
                  833 
                  -
                  846 hipError_t hipMemset(void* dst, int value, size_t sizeBytes );
                  -
                  847 
                  -
                  848 
                  -
                  862 hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t = 0 );
                  -
                  863 
                  -
                  864 
                  -
                  871 hipError_t hipMemGetInfo (size_t * free, size_t * total) ;
                  -
                  872 
                  -
                  873 // doxygen end Memory
                  -
                  898 hipError_t hipDeviceCanAccessPeer ( int* canAccessPeer, int device, int peerDevice );
                  -
                  899 
                  -
                  900 
                  -
                  901 
                  -
                  912 hipError_t hipDeviceDisablePeerAccess ( int peerDevice );
                  -
                  913 
                  -
                  923 hipError_t hipDeviceEnablePeerAccess ( int peerDevice, unsigned int flags );
                  -
                  924 
                  -
                  936 hipError_t hipMemcpyPeer ( void* dst, int dstDevice, const void* src, int srcDevice, size_t sizeBytes );
                  +
                  790 hipError_t hipHostFree(void* ptr);
                  +
                  791 
                  +
                  792 
                  +
                  793 
                  +
                  807 hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind);
                  +
                  808 
                  +
                  809 
                  +
                  824 hipError_t hipMemcpyToSymbol(const char* symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind);
                  +
                  825 
                  +
                  826 
                  +
                  839 #if __cplusplus
                  +
                  840 hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream=0);
                  +
                  841 #else
                  +
                  842 hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream);
                  +
                  843 #endif
                  +
                  844 
                  +
                  857 hipError_t hipMemset(void* dst, int value, size_t sizeBytes );
                  +
                  858 
                  +
                  859 
                  +
                  873 #if __cplusplus
                  +
                  874 hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t = 0 );
                  +
                  875 #else
                  +
                  876 hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t stream);
                  +
                  877 #endif
                  +
                  878 
                  +
                  885 hipError_t hipMemGetInfo (size_t * free, size_t * total) ;
                  +
                  886 
                  +
                  887 // doxygen end Memory
                  +
                  919 hipError_t hipDeviceCanAccessPeer (int* canAccessPeer, int deviceId, int peerDeviceId);
                  +
                  920 
                  +
                  921 
                  +
                  936 hipError_t hipDeviceEnablePeerAccess (int peerDeviceId, unsigned int flags);
                  937 
                  -
                  950 hipError_t hipMemcpyPeerAsync ( void* dst, int dstDevice, const void* src, int srcDevice, size_t sizeBytes, hipStream_t stream=0 );
                  -
                  951 // doxygen end PeerToPeer
                  -
                  975 hipError_t hipDriverGetVersion(int *driverVersion) ;
                  -
                  976 
                  -
                  977 
                  -
                  978 
                  -
                  979 // doxygen end Version Management
                  -
                  1006 #ifdef __cplusplus
                  -
                  1007 } /* extern "c" */
                  -
                  1008 #endif
                  -
                  1009 
                  -
                  1010 
                  -
                  1028 #ifdef __HCC__
                  -
                  1029 #include <hc.hpp>
                  -
                  1033 hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc);
                  -
                  1034 
                  -
                  1038 hipError_t hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av);
                  -
                  1039 #endif
                  -
                  1040 
                  -
                  1041 
                  -
                  1042 // end-group HCC_Specific
                  -
                  1049 // doxygen end HIP API
                  -
                  hipError_t hipHostFree(void *ptr)
                  Free memory allocated by the hcc hip host memory allocation API.
                  Definition: hip_hcc.cpp:2750
                  -
                  hipError_t hipDeviceEnablePeerAccess(int peerDevice, unsigned int flags)
                  Enables registering memory on peerDevice for direct access from the current device.
                  Definition: hip_hcc.cpp:2812
                  -
                  hipError_t hipDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice)
                  Determine if a device can access a peer's memory.
                  Definition: hip_hcc.cpp:2786
                  +
                  938 
                  +
                  948 hipError_t hipDeviceDisablePeerAccess (int peerDeviceId);
                  +
                  949 
                  +
                  950 
                  +
                  962 hipError_t hipMemcpyPeer (void* dst, int dstDeviceId, const void* src, int srcDeviceId, size_t sizeBytes);
                  +
                  963 
                  +
                  976 #if __cplusplus
                  +
                  977 hipError_t hipMemcpyPeerAsync ( void* dst, int dstDeviceId, const void* src, int srcDevice, size_t sizeBytes, hipStream_t stream=0 );
                  +
                  978 #else
                  +
                  979 hipError_t hipMemcpyPeerAsync(void* dst, int dstDevice, const void* src, int srcDevice, size_t sizeBytes, hipStream_t stream);
                  +
                  980 #endif
                  +
                  981 // doxygen end PeerToPeer
                  +
                  1005 hipError_t hipDriverGetVersion(int *driverVersion) ;
                  +
                  1006 
                  +
                  1007 
                  +
                  1008 
                  +
                  1009 // doxygen end Version Management
                  +
                  1036 #ifdef __cplusplus
                  +
                  1037 } /* extern "c" */
                  +
                  1038 #endif
                  +
                  1039 
                  +
                  1040 
                  +
                  1058 // end-group HCC_Specific
                  +
                  1065 // doxygen end HIP API
                  +
                  1070 #endif
                  +
                  hipError_t hipHostFree(void *ptr)
                  Free memory allocated by the hcc hip host memory allocation API.
                  Definition: hip_memory.cpp:488
                  +
                  hipError_t hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream)
                  Copy data from src to dst asynchronously.
                  Definition: hip_memory.cpp:343
                  hipError_t hipPeekAtLastError(void)
                  Return last error returned by any HIP runtime API call.
                  -
                  hipError_t hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av)
                  Return hc::accelerator_view associated with the specified stream.
                  Definition: hip_hcc.cpp:2886
                  struct dim3 dim3
                  TODO-doc.
                  -
                  hipError_t hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t=0)
                  Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value val...
                  Definition: hip_hcc.cpp:2632
                  -
                  hipError_t hipGetDeviceProperties(hipDeviceProp_t *prop, int device)
                  Returns device properties.
                  Definition: hip_hcc.cpp:1586
                  -
                  hipError_t hipMemcpyToSymbol(const char *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind)
                  Copies sizeBytes bytes from the memory area pointed to by src to the memory area pointed to by offset...
                  Definition: hip_hcc.cpp:2326
                  -
                  hipError_t hipFuncSetCacheConfig(hipFuncCache config)
                  Set Cache configuration for a specific function.
                  Definition: hip_hcc.cpp:1405
                  -
                  no preference for shared memory or L1 (default)
                  Definition: hip_runtime_api.h:75
                  -
                  uint32_t x
                  x
                  Definition: hip_runtime_api.h:98
                  -
                  Host-to-Device Copy.
                  Definition: hip_runtime_api.h:113
                  -
                  hipError_t hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig)
                  Get Shared memory bank configuration.
                  Definition: hip_hcc.cpp:1435
                  -
                  hipError_t hipSetDevice(int device)
                  Set default device to be used for subsequent hip API calls from this thread.
                  Definition: hip_hcc.cpp:1448
                  +
                  hipError_t hipGetDeviceProperties(hipDeviceProp_t *prop, int device)
                  Returns device properties.
                  Definition: hip_device.cpp:267
                  +
                  hipError_t hipMemcpyToSymbol(const char *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind)
                  Copies sizeBytes bytes from the memory area pointed to by src to the memory area pointed to by offset...
                  Definition: hip_memory.cpp:291
                  +
                  hipError_t hipFuncSetCacheConfig(hipFuncCache config)
                  Set Cache configuration for a specific function.
                  Definition: hip_device.cpp:90
                  +
                  no preference for shared memory or L1 (default)
                  Definition: hip_runtime_api.h:92
                  +
                  uint32_t x
                  x
                  Definition: hip_runtime_api.h:115
                  +
                  Host-to-Device Copy.
                  Definition: hip_runtime_api.h:131
                  +
                  hipError_t hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags)
                  Enable direct access from current device's virtual address space to memory allocations physically loc...
                  Definition: hip_peer.cpp:101
                  +
                  hipError_t hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig)
                  Get Shared memory bank configuration.
                  Definition: hip_device.cpp:120
                  +
                  hipError_t hipSetDevice(int device)
                  Set default device to be used for subsequent hip API calls from this thread.
                  Definition: hip_device.cpp:133
                  Definition: hip_runtime_api.h:117
                  -
                  Device-to-Host Copy.
                  Definition: hip_runtime_api.h:114
                  +
                  Device-to-Host Copy.
                  Definition: hip_runtime_api.h:132
                  hipError_t hipHostGetDevicePointer(void **devPtr, void *hstPtr, unsigned int flags)
                  Get Device pointer from Host Pointer allocated through hipHostAlloc.
                  -
                  hipError_t hipEventSynchronize(hipEvent_t event)
                  : Wait for an event to complete.
                  Definition: hip_hcc.cpp:1886
                  -
                  hipFuncCache
                  Definition: hip_runtime_api.h:74
                  -
                  hipError_t hipEventQuery(hipEvent_t event)
                  Query event status.
                  Definition: hip_hcc.cpp:1983
                  -
                  hipError_t hipDeviceGetCacheConfig(hipFuncCache *cacheConfig)
                  Set Cache configuration for a specific function.
                  Definition: hip_hcc.cpp:1391
                  -
                  hipError_t hipMemcpyPeer(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes)
                  Copies memory from one device to memory on another device.
                  Definition: hip_hcc.cpp:2821
                  -
                  hipError_t hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device)
                  Query device attribute.
                  Definition: hip_hcc.cpp:1510
                  -
                  hipError_t hipMallocHost(void **ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead")))
                  Allocate pinned host memory.
                  Definition: hip_hcc.cpp:2190
                  -
                  hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream=NULL)
                  Record an event in the specified stream.
                  Definition: hip_hcc.cpp:1836
                  -
                  hipError_t hipGetDevice(int *device)
                  Return the default device id for the calling host thread.
                  Definition: hip_hcc.cpp:1346
                  -
                  hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
                  Allocate device accessible page locked host memory.
                  Definition: hip_hcc.cpp:2214
                  -
                  hipDeviceAttribute_t
                  Definition: hip_runtime_api.h:168
                  -
                  hipError_t hipEventDestroy(hipEvent_t event)
                  Destroy the specified event.
                  Definition: hip_hcc.cpp:1871
                  -
                  hipError_t hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags)
                  Create an asynchronous stream.
                  Definition: hip_hcc.cpp:1690
                  -
                  hipError_t hipDeviceDisablePeerAccess(int peerDevice)
                  Disables registering memory on peerDevice for direct access from the current device.
                  Definition: hip_hcc.cpp:2799
                  -
                  Definition: hip_runtime_api.h:97
                  -
                  uint32_t y
                  y
                  Definition: hip_runtime_api.h:99
                  -
                  prefer equal size L1 cache and shared memory
                  Definition: hip_runtime_api.h:78
                  -
                  hipError_t hipEventCreateWithFlags(hipEvent_t *event, unsigned flags)
                  Create an event with the specified flags.
                  Definition: hip_hcc.cpp:1811
                  -
                  hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop)
                  Return the elapsed time between two events.
                  Definition: hip_hcc.cpp:1938
                  -
                  hipError_t hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream=0)
                  Copies memory from one device to memory on another device.
                  Definition: hip_hcc.cpp:2833
                  -
                  hipError_t hipGetDeviceCount(int *count)
                  Return number of compute-capable devices.
                  Definition: hip_hcc.cpp:1359
                  -
                  hipError_t hipMemset(void *dst, int value, size_t sizeBytes)
                  Copy data from src to dst asynchronously.
                  Definition: hip_hcc.cpp:2682
                  -
                  hipError_t hipStreamDestroy(hipStream_t stream)
                  Destroys the specified stream.
                  Definition: hip_hcc.cpp:1759
                  -
                  hipError_t hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr)
                  Get flags associated with host pointer.
                  Definition: hip_hcc.cpp:2252
                  -
                  hipError_t hipStreamSynchronize(hipStream_t stream)
                  Wait for all commands in stream to complete.
                  Definition: hip_hcc.cpp:1736
                  -
                  Shared mem is banked at 4-bytes intervals and performs best when adjacent threads access data 4 bytes...
                  Definition: hip_runtime_api.h:87
                  +
                  hipError_t hipEventSynchronize(hipEvent_t event)
                  : Wait for an event to complete.
                  Definition: hip_event.cpp:121
                  +
                  hipError_t hipSetDeviceFlags(unsigned flags)
                  Set Device flags.
                  +
                  hipFuncCache
                  Definition: hip_runtime_api.h:91
                  +
                  hipError_t hipEventQuery(hipEvent_t event)
                  Query event status.
                  Definition: hip_event.cpp:199
                  +
                  hipError_t hipDeviceGetCacheConfig(hipFuncCache *cacheConfig)
                  Set Cache configuration for a specific function.
                  Definition: hip_device.cpp:76
                  +
                  hipError_t hipDeviceDisablePeerAccess(int peerDeviceId)
                  Disable direct access from current device's virtual address space to memory allocations physically lo...
                  Definition: hip_peer.cpp:61
                  +
                  hipError_t hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device)
                  Query device attribute.
                  Definition: hip_device.cpp:191
                  +
                  hipError_t hipMallocHost(void **ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead")))
                  Allocate pinned host memory.
                  Definition: hip_memory.cpp:203
                  +
                  hipError_t hipGetDevice(int *device)
                  Return the default device id for the calling host thread.
                  Definition: hip_device.cpp:31
                  +
                  hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
                  Allocate device accessible page locked host memory.
                  Definition: hip_memory.cpp:152
                  +
                  hipDeviceAttribute_t
                  Definition: hip_runtime_api.h:170
                  +
                  hipError_t hipEventDestroy(hipEvent_t event)
                  Destroy the specified event.
                  Definition: hip_event.cpp:106
                  +
                  hipError_t hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags)
                  Create an asynchronous stream.
                  Definition: hip_stream.cpp:54
                  +
                  Definition: hip_runtime_api.h:114
                  +
                  uint32_t y
                  y
                  Definition: hip_runtime_api.h:116
                  +
                  prefer equal size L1 cache and shared memory
                  Definition: hip_runtime_api.h:95
                  +
                  hipError_t hipEventCreateWithFlags(hipEvent_t *event, unsigned flags)
                  Create an event with the specified flags.
                  Definition: hip_event.cpp:53
                  +
                  hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop)
                  Return the elapsed time between two events.
                  Definition: hip_event.cpp:154
                  +
                  hipError_t hipDeviceCanAccessPeer(int *canAccessPeer, int deviceId, int peerDeviceId)
                  Determine if a device can access a peer's memory.
                  Definition: hip_peer.cpp:30
                  +
                  hipError_t hipGetDeviceCount(int *count)
                  Return number of compute-capable devices.
                  Definition: hip_device.cpp:44
                  +
                  hipError_t hipMemset(void *dst, int value, size_t sizeBytes)
                  Copy data from src to dst asynchronously.
                  Definition: hip_memory.cpp:422
                  +
                  hipError_t hipStreamDestroy(hipStream_t stream)
                  Destroys the specified stream.
                  Definition: hip_stream.cpp:117
                  +
                  hipError_t hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr)
                  Get flags associated with host pointer.
                  Definition: hip_memory.cpp:210
                  +
                  hipError_t hipStreamSynchronize(hipStream_t stream)
                  Wait for all commands in stream to complete.
                  Definition: hip_stream.cpp:94
                  +
                  Shared mem is banked at 4-bytes intervals and performs best when adjacent threads access data 4 bytes...
                  Definition: hip_runtime_api.h:104
                  hipError_t
                  Definition: hip_runtime_api.h:142
                  -
                  hipMemcpyKind
                  Definition: hip_runtime_api.h:111
                  -
                  prefer larger L1 cache and smaller shared memory
                  Definition: hip_runtime_api.h:77
                  -
                  hipError_t hipDriverGetVersion(int *driverVersion)
                  Returns the approximate HIP driver version.
                  Definition: hip_hcc.cpp:2845
                  -
                  hipError_t hipDeviceSynchronize(void)
                  Blocks until the default device has completed all preceding requested tasks.
                  Definition: hip_hcc.cpp:1465
                  -
                  Definition: hip_runtime_api.h:136
                  -
                  hipError_t hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags)
                  Register host memory so it can be accessed from the current device.
                  Definition: hip_hcc.cpp:2276
                  -
                  hipError_t hipDeviceSetCacheConfig(hipFuncCache cacheConfig)
                  Set L1/Shared cache partition.
                  Definition: hip_hcc.cpp:1377
                  -
                  hipError_t hipMalloc(void **ptr, size_t size)
                  Allocate memory on the default accelerator.
                  Definition: hip_hcc.cpp:2165
                  -
                  const char * hipGetErrorName(hipError_t hip_error)
                  Return name of the specified error code in text form.
                  Definition: hip_hcc.cpp:1661
                  -
                  hipError_t hipGetLastError(void)
                  Return last error returned by any HIP runtime API call and resets the stored error code to hipSuccess...
                  Definition: hip_hcc.cpp:1614
                  -
                  hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags)
                  Make the specified compute stream wait for an event.
                  Definition: hip_hcc.cpp:1716
                  -
                  hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags)
                  Return flags associated with this stream.
                  Definition: hip_hcc.cpp:1788
                  -
                  #define hipStreamDefault
                  Flags that can be used with hipStreamCreateWithFlags.
                  Definition: hip_runtime_api.h:48
                  -
                  hipError_t hipMemGetInfo(size_t *free, size_t *total)
                  Query memory info. Return snapshot of free memory, and total allocatable memory on the device...
                  Definition: hip_hcc.cpp:2695
                  -
                  hipError_t hipFree(void *ptr)
                  Free memory allocated by the hcc hip memory allocation API. This API performs an implicit hipDeviceSy...
                  Definition: hip_hcc.cpp:2725
                  -
                  uint32_t z
                  z
                  Definition: hip_runtime_api.h:100
                  -
                  hipError_t hipDeviceReset(void)
                  Destroy all resources and reset all state on the default device in the current process.
                  Definition: hip_hcc.cpp:1480
                  +
                  hipMemcpyKind
                  Definition: hip_runtime_api.h:129
                  +
                  prefer larger L1 cache and smaller shared memory
                  Definition: hip_runtime_api.h:94
                  +
                  hipError_t hipDriverGetVersion(int *driverVersion)
                  Returns the approximate HIP driver version.
                  Definition: hip_peer.cpp:156
                  +
                  hipError_t hipDeviceSynchronize(void)
                  Blocks until the default device has completed all preceding requested tasks.
                  Definition: hip_device.cpp:149
                  +
                  Definition: hip_runtime_api.h:47
                  +
                  hipError_t hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags)
                  Register host memory so it can be accessed from the current device.
                  Definition: hip_memory.cpp:236
                  +
                  hipError_t hipDeviceSetCacheConfig(hipFuncCache cacheConfig)
                  Set L1/Shared cache partition.
                  Definition: hip_device.cpp:62
                  +
                  hipError_t hipMalloc(void **ptr, size_t size)
                  Allocate memory on the default accelerator.
                  Definition: hip_memory.cpp:117
                  +
                  const char * hipGetErrorName(hipError_t hip_error)
                  Return name of the specified error code in text form.
                  Definition: hip_error.cpp:53
                  +
                  hipError_t hipGetLastError(void)
                  Return last error returned by any HIP runtime API call and resets the stored error code to hipSuccess...
                  Definition: hip_error.cpp:31
                  +
                  hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags)
                  Make the specified compute stream wait for an event.
                  Definition: hip_stream.cpp:75
                  +
                  hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags)
                  Return flags associated with this stream.
                  Definition: hip_stream.cpp:146
                  +
                  hipError_t hipMemGetInfo(size_t *free, size_t *total)
                  Query memory info. Return snapshot of free memory, and total allocatable memory on the device...
                  Definition: hip_memory.cpp:435
                  +
                  hipError_t hipFree(void *ptr)
                  Free memory allocated by the hcc hip memory allocation API. This API performs an implicit hipDeviceSy...
                  Definition: hip_memory.cpp:463
                  +
                  uint32_t z
                  z
                  Definition: hip_runtime_api.h:117
                  +
                  hipError_t hipDeviceReset(void)
                  Destroy all resources and reset all state on the default device in the current process.
                  Definition: hip_device.cpp:163
                  Definition: hip_runtime_api.h:74
                  -
                  hipError_t hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream=0)
                  Copy data from src to dst asynchronously.
                  Definition: hip_hcc.cpp:2603
                  -
                  The compiler selects a device-specific value for the banking.
                  Definition: hip_runtime_api.h:86
                  -
                  Device-to-Device Copy.
                  Definition: hip_runtime_api.h:115
                  -
                  Definition: hip_hcc.cpp:363
                  -
                  Runtime will automatically determine copy-kind based on virtual addresses.
                  Definition: hip_runtime_api.h:116
                  -
                  hipSharedMemConfig
                  Definition: hip_runtime_api.h:85
                  -
                  hipError_t hipHostUnregister(void *hostPtr)
                  Un-register host pointer.
                  Definition: hip_hcc.cpp:2307
                  -
                  Definition: hip_hcc.cpp:284
                  -
                  hipError_t hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind)
                  Copy data from src to dst.
                  Definition: hip_hcc.cpp:2569
                  -
                  hipError_t hipFreeHost(void *ptr) __attribute__((deprecated("use hipHostFree instead")))
                  Free memory allocated by the hcc hip host memory allocation API.
                  Definition: hip_hcc.cpp:2775
                  -
                  hipError_t hipDeviceSetSharedMemConfig(hipSharedMemConfig config)
                  Set Shared memory bank configuration.
                  Definition: hip_hcc.cpp:1420
                  -
                  prefer larger shared memory and smaller L1 cache
                  Definition: hip_runtime_api.h:76
                  -
                  Host-to-Host Copy.
                  Definition: hip_runtime_api.h:112
                  -
                  hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc)
                  Return hc::accelerator associated with the specified deviceId.
                  Definition: hip_hcc.cpp:2866
                  -
                  hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr)
                  Return attributes for the specified pointer.
                  Definition: hip_hcc.cpp:2012
                  -
                  Shared mem is banked at 8-byte intervals and performs best when adjacent threads access data 4 bytes ...
                  Definition: hip_runtime_api.h:88
                  -
                  const char * hipGetErrorString(hipError_t hip_error)
                  Return handy text string message to explain the error which occurred.
                  Definition: hip_hcc.cpp:1674
                  +
                  hipError_t hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t stream)
                  Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value val...
                  Definition: hip_memory.cpp:372
                  +
                  The compiler selects a device-specific value for the banking.
                  Definition: hip_runtime_api.h:103
                  +
                  Device-to-Device Copy.
                  Definition: hip_runtime_api.h:133
                  +
                  Definition: hip_hcc.h:483
                  +
                  hipError_t hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream)
                  Copies memory from one device to memory on another device.
                  Definition: hip_peer.cpp:144
                  +
                  Runtime will automatically determine copy-kind based on virtual addresses.
                  Definition: hip_runtime_api.h:134
                  +
                  hipSharedMemConfig
                  Definition: hip_runtime_api.h:102
                  +
                  hipError_t hipHostUnregister(void *hostPtr)
                  Un-register host pointer.
                  Definition: hip_memory.cpp:272
                  +
                  Definition: hip_hcc.h:399
                  +
                  hipError_t hipMemcpyPeer(void *dst, int dstDeviceId, const void *src, int srcDeviceId, size_t sizeBytes)
                  Copies memory from one device to memory on another device.
                  Definition: hip_peer.cpp:131
                  +
                  hipError_t hipStreamCreate(hipStream_t *stream)
                  Create an asynchronous stream.
                  Definition: hip_stream.cpp:63
                  +
                  Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
                  +
                  hipError_t hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind)
                  Copy data from src to dst.
                  Definition: hip_memory.cpp:312
                  +
                  hipError_t hipEventCreate(hipEvent_t *event)
                  Definition: hip_event.cpp:61
                  +
                  hipError_t hipFreeHost(void *ptr) __attribute__((deprecated("use hipHostFree instead")))
                  Free memory allocated by the hcc hip host memory allocation API.
                  Definition: hip_memory.cpp:513
                  +
                  hipError_t hipDeviceSetSharedMemConfig(hipSharedMemConfig config)
                  Set Shared memory bank configuration.
                  Definition: hip_device.cpp:105
                  +
                  hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream)
                  Record an event in the specified stream.
                  Definition: hip_event.cpp:70
                  +
                  prefer larger shared memory and smaller L1 cache
                  Definition: hip_runtime_api.h:93
                  +
                  Host-to-Host Copy.
                  Definition: hip_runtime_api.h:130
                  +
                  hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr)
                  Return attributes for the specified pointer.
                  Definition: hip_memory.cpp:37
                  +
                  Shared mem is banked at 8-byte intervals and performs best when adjacent threads access data 4 bytes ...
                  Definition: hip_runtime_api.h:105
                  +
                  const char * hipGetErrorString(hipError_t hip_error)
                  Return handy text string message to explain the error which occurred.
                  Definition: hip_error.cpp:66
                  diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h.html b/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h.html index e4dc64a7f8..ebed2f5949 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/hip_vector_types.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_vector_types.h File Reference @@ -96,8 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

                  Defines the different newt vector types for HIP runtime. More...

                  -
                  #include <hc_short_vector.hpp>
                  -
                  +

                  Go to the source code of this file.

                  diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h_source.html b/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h_source.html index 8074ddd763..ef5a671084 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h_source.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/hip_vector_types.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_vector_types.h Source File @@ -111,176 +111,187 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  20 THE SOFTWARE.
                  21 */
                  22 
                  -
                  28 #if defined (__HCC__) && (__hcc_workweek__ < 16032)
                  -
                  29 #error("This version of HIP requires a newer version of HCC.");
                  -
                  30 #endif
                  -
                  31 
                  -
                  32 #include <hc_short_vector.hpp>
                  -
                  33 
                  -
                  34 //-- Signed
                  -
                  35 // Define char vector types
                  -
                  36 typedef hc::short_vector::char1 char1;
                  -
                  37 typedef hc::short_vector::char2 char2;
                  -
                  38 typedef hc::short_vector::char3 char3;
                  -
                  39 typedef hc::short_vector::char4 char4;
                  -
                  40 
                  -
                  41 // Define short vector types
                  -
                  42 typedef hc::short_vector::short1 short1;
                  -
                  43 typedef hc::short_vector::short2 short2;
                  -
                  44 typedef hc::short_vector::short3 short3;
                  -
                  45 typedef hc::short_vector::short4 short4;
                  -
                  46 
                  -
                  47 // Define int vector types
                  -
                  48 typedef hc::short_vector::int1 int1;
                  -
                  49 typedef hc::short_vector::int2 int2;
                  -
                  50 typedef hc::short_vector::int3 int3;
                  -
                  51 typedef hc::short_vector::int4 int4;
                  -
                  52 
                  -
                  53 // Define long vector types
                  -
                  54 typedef hc::short_vector::long1 long1;
                  -
                  55 typedef hc::short_vector::long2 long2;
                  -
                  56 typedef hc::short_vector::long3 long3;
                  -
                  57 typedef hc::short_vector::long4 long4;
                  -
                  58 
                  -
                  59 // Define longlong vector types
                  -
                  60 typedef hc::short_vector::longlong1 longlong1;
                  -
                  61 typedef hc::short_vector::longlong2 longlong2;
                  -
                  62 typedef hc::short_vector::longlong3 longlong3;
                  -
                  63 typedef hc::short_vector::longlong4 longlong4;
                  -
                  64 
                  +
                  28 #ifndef HIP_VECTOR_TYPES_H
                  +
                  29 #define HIP_VECTOR_TYPES_H
                  +
                  30 
                  +
                  31 #if defined (__HCC__) && (__hcc_workweek__ < 16032)
                  +
                  32 #error("This version of HIP requires a newer version of HCC.");
                  +
                  33 #endif
                  +
                  34 
                  +
                  35 #if __cplusplus
                  +
                  36 #include <hc_short_vector.hpp>
                  +
                  37 
                  +
                  38 using namespace hc::short_vector;
                  +
                  39 #endif
                  +
                  40 
                  +
                  41 //-- Signed
                  +
                  42 // Define char vector types
                  +
                  43 typedef hc::short_vector::char1 char1;
                  +
                  44 typedef hc::short_vector::char2 char2;
                  +
                  45 typedef hc::short_vector::char3 char3;
                  +
                  46 typedef hc::short_vector::char4 char4;
                  +
                  47 
                  +
                  48 // Define short vector types
                  +
                  49 typedef hc::short_vector::short1 short1;
                  +
                  50 typedef hc::short_vector::short2 short2;
                  +
                  51 typedef hc::short_vector::short3 short3;
                  +
                  52 typedef hc::short_vector::short4 short4;
                  +
                  53 
                  +
                  54 // Define int vector types
                  +
                  55 typedef hc::short_vector::int1 int1;
                  +
                  56 typedef hc::short_vector::int2 int2;
                  +
                  57 typedef hc::short_vector::int3 int3;
                  +
                  58 typedef hc::short_vector::int4 int4;
                  +
                  59 
                  +
                  60 // Define long vector types
                  +
                  61 typedef hc::short_vector::long1 long1;
                  +
                  62 typedef hc::short_vector::long2 long2;
                  +
                  63 typedef hc::short_vector::long3 long3;
                  +
                  64 typedef hc::short_vector::long4 long4;
                  65 
                  -
                  66 //-- Unsigned
                  -
                  67 // Define uchar vector types
                  -
                  68 typedef hc::short_vector::uchar1 uchar1;
                  -
                  69 typedef hc::short_vector::uchar2 uchar2;
                  -
                  70 typedef hc::short_vector::uchar3 uchar3;
                  -
                  71 typedef hc::short_vector::uchar4 uchar4;
                  +
                  66 // Define longlong vector types
                  +
                  67 typedef hc::short_vector::longlong1 longlong1;
                  +
                  68 typedef hc::short_vector::longlong2 longlong2;
                  +
                  69 typedef hc::short_vector::longlong3 longlong3;
                  +
                  70 typedef hc::short_vector::longlong4 longlong4;
                  +
                  71 
                  72 
                  -
                  73 // Define ushort vector types
                  -
                  74 typedef hc::short_vector::ushort1 ushort1;
                  -
                  75 typedef hc::short_vector::ushort2 ushort2;
                  -
                  76 typedef hc::short_vector::ushort3 ushort3;
                  -
                  77 typedef hc::short_vector::ushort4 ushort4;
                  -
                  78 
                  -
                  79 // Define uint vector types
                  -
                  80 typedef hc::short_vector::uint1 uint1;
                  -
                  81 typedef hc::short_vector::uint2 uint2;
                  -
                  82 typedef hc::short_vector::uint3 uint3;
                  -
                  83 typedef hc::short_vector::uint4 uint4;
                  -
                  84 
                  -
                  85 // Define ulong vector types
                  -
                  86 typedef hc::short_vector::ulong1 ulong1;
                  -
                  87 typedef hc::short_vector::ulong2 ulong2;
                  -
                  88 typedef hc::short_vector::ulong3 ulong3;
                  -
                  89 typedef hc::short_vector::ulong4 ulong4;
                  -
                  90 
                  -
                  91 // Define ulonglong vector types
                  -
                  92 typedef hc::short_vector::ulonglong1 ulonglong1;
                  -
                  93 typedef hc::short_vector::ulonglong2 ulonglong2;
                  -
                  94 typedef hc::short_vector::ulonglong3 ulonglong3;
                  -
                  95 typedef hc::short_vector::ulonglong4 ulonglong4;
                  -
                  96 
                  +
                  73 //-- Unsigned
                  +
                  74 // Define uchar vector types
                  +
                  75 typedef hc::short_vector::uchar1 uchar1;
                  +
                  76 typedef hc::short_vector::uchar2 uchar2;
                  +
                  77 typedef hc::short_vector::uchar3 uchar3;
                  +
                  78 typedef hc::short_vector::uchar4 uchar4;
                  +
                  79 
                  +
                  80 // Define ushort vector types
                  +
                  81 typedef hc::short_vector::ushort1 ushort1;
                  +
                  82 typedef hc::short_vector::ushort2 ushort2;
                  +
                  83 typedef hc::short_vector::ushort3 ushort3;
                  +
                  84 typedef hc::short_vector::ushort4 ushort4;
                  +
                  85 
                  +
                  86 // Define uint vector types
                  +
                  87 typedef hc::short_vector::uint1 uint1;
                  +
                  88 typedef hc::short_vector::uint2 uint2;
                  +
                  89 typedef hc::short_vector::uint3 uint3;
                  +
                  90 typedef hc::short_vector::uint4 uint4;
                  +
                  91 
                  +
                  92 // Define ulong vector types
                  +
                  93 typedef hc::short_vector::ulong1 ulong1;
                  +
                  94 typedef hc::short_vector::ulong2 ulong2;
                  +
                  95 typedef hc::short_vector::ulong3 ulong3;
                  +
                  96 typedef hc::short_vector::ulong4 ulong4;
                  97 
                  -
                  98 //-- Floating point
                  -
                  99 // Define float vector types
                  -
                  100 typedef hc::short_vector::float1 float1;
                  -
                  101 typedef hc::short_vector::float2 float2;
                  -
                  102 typedef hc::short_vector::float3 float3;
                  -
                  103 typedef hc::short_vector::float4 float4;
                  +
                  98 // Define ulonglong vector types
                  +
                  99 typedef hc::short_vector::ulonglong1 ulonglong1;
                  +
                  100 typedef hc::short_vector::ulonglong2 ulonglong2;
                  +
                  101 typedef hc::short_vector::ulonglong3 ulonglong3;
                  +
                  102 typedef hc::short_vector::ulonglong4 ulonglong4;
                  +
                  103 
                  104 
                  -
                  105 // Define double vector types
                  -
                  106 typedef hc::short_vector::double1 double1;
                  -
                  107 typedef hc::short_vector::double2 double2;
                  -
                  108 typedef hc::short_vector::double3 double3;
                  -
                  109 typedef hc::short_vector::double4 double4;
                  -
                  110 
                  +
                  105 //-- Floating point
                  +
                  106 // Define float vector types
                  +
                  107 typedef hc::short_vector::float1 float1;
                  +
                  108 typedef hc::short_vector::float2 float2;
                  +
                  109 typedef hc::short_vector::float3 float3;
                  +
                  110 typedef hc::short_vector::float4 float4;
                  111 
                  -
                  113 // Inline functions for creating vector types from basic types
                  -
                  114 #define ONE_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x) { VT t; t.x = x; return t; };
                  -
                  115 #define TWO_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x, T y) { VT t; t.x=x; t.y=y; return t; };
                  -
                  116 #define THREE_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x, T y, T z) { VT t; t.x=x; t.y=y; t.z=z; return t; };
                  -
                  117 #define FOUR_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x, T y, T z, T w) { VT t; t.x=x; t.y=y; t.z=z; t.w=w; return t; };
                  -
                  118 
                  -
                  119 
                  -
                  120 //signed:
                  -
                  121 ONE_COMPONENT_ACCESS (signed char, char1);
                  -
                  122 TWO_COMPONENT_ACCESS (signed char, char2);
                  -
                  123 THREE_COMPONENT_ACCESS(signed char, char3);
                  -
                  124 FOUR_COMPONENT_ACCESS (signed char, char4);
                  -
                  125 
                  -
                  126 ONE_COMPONENT_ACCESS (short, short1);
                  -
                  127 TWO_COMPONENT_ACCESS (short, short2);
                  -
                  128 THREE_COMPONENT_ACCESS(short, short3);
                  -
                  129 FOUR_COMPONENT_ACCESS (short, short4);
                  -
                  130 
                  -
                  131 ONE_COMPONENT_ACCESS (int, int1);
                  -
                  132 TWO_COMPONENT_ACCESS (int, int2);
                  -
                  133 THREE_COMPONENT_ACCESS(int, int3);
                  -
                  134 FOUR_COMPONENT_ACCESS (int, int4);
                  -
                  135 
                  -
                  136 ONE_COMPONENT_ACCESS (long int, long1);
                  -
                  137 TWO_COMPONENT_ACCESS (long int, long2);
                  -
                  138 THREE_COMPONENT_ACCESS(long int, long3);
                  -
                  139 FOUR_COMPONENT_ACCESS (long int, long4);
                  -
                  140 
                  -
                  141 ONE_COMPONENT_ACCESS (long long int, ulong1);
                  -
                  142 TWO_COMPONENT_ACCESS (long long int, ulong2);
                  -
                  143 THREE_COMPONENT_ACCESS(long long int, ulong3);
                  -
                  144 FOUR_COMPONENT_ACCESS (long long int, ulong4);
                  -
                  145 
                  -
                  146 ONE_COMPONENT_ACCESS (long long int, longlong1);
                  -
                  147 TWO_COMPONENT_ACCESS (long long int, longlong2);
                  -
                  148 THREE_COMPONENT_ACCESS(long long int, longlong3);
                  -
                  149 FOUR_COMPONENT_ACCESS (long long int, longlong4);
                  -
                  150 
                  -
                  151 
                  -
                  152 // unsigned:
                  -
                  153 ONE_COMPONENT_ACCESS (unsigned char, uchar1);
                  -
                  154 TWO_COMPONENT_ACCESS (unsigned char, uchar2);
                  -
                  155 THREE_COMPONENT_ACCESS(unsigned char, uchar3);
                  -
                  156 FOUR_COMPONENT_ACCESS (unsigned char, uchar4);
                  +
                  112 // Define double vector types
                  +
                  113 typedef hc::short_vector::double1 double1;
                  +
                  114 typedef hc::short_vector::double2 double2;
                  +
                  115 typedef hc::short_vector::double3 double3;
                  +
                  116 typedef hc::short_vector::double4 double4;
                  +
                  117 
                  +
                  118 
                  +
                  120 // Inline functions for creating vector types from basic types
                  +
                  121 #define ONE_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x) { VT t; t.x = x; return t; };
                  +
                  122 #define TWO_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x, T y) { VT t; t.x=x; t.y=y; return t; };
                  +
                  123 #define THREE_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x, T y, T z) { VT t; t.x=x; t.y=y; t.z=z; return t; };
                  +
                  124 #define FOUR_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x, T y, T z, T w) { VT t; t.x=x; t.y=y; t.z=z; t.w=w; return t; };
                  +
                  125 
                  +
                  126 
                  +
                  127 //signed:
                  +
                  128 ONE_COMPONENT_ACCESS (signed char, char1);
                  +
                  129 TWO_COMPONENT_ACCESS (signed char, char2);
                  +
                  130 THREE_COMPONENT_ACCESS(signed char, char3);
                  +
                  131 FOUR_COMPONENT_ACCESS (signed char, char4);
                  +
                  132 
                  +
                  133 ONE_COMPONENT_ACCESS (short, short1);
                  +
                  134 TWO_COMPONENT_ACCESS (short, short2);
                  +
                  135 THREE_COMPONENT_ACCESS(short, short3);
                  +
                  136 FOUR_COMPONENT_ACCESS (short, short4);
                  +
                  137 
                  +
                  138 ONE_COMPONENT_ACCESS (int, int1);
                  +
                  139 TWO_COMPONENT_ACCESS (int, int2);
                  +
                  140 THREE_COMPONENT_ACCESS(int, int3);
                  +
                  141 FOUR_COMPONENT_ACCESS (int, int4);
                  +
                  142 
                  +
                  143 ONE_COMPONENT_ACCESS (long int, long1);
                  +
                  144 TWO_COMPONENT_ACCESS (long int, long2);
                  +
                  145 THREE_COMPONENT_ACCESS(long int, long3);
                  +
                  146 FOUR_COMPONENT_ACCESS (long int, long4);
                  +
                  147 
                  +
                  148 ONE_COMPONENT_ACCESS (long long int, ulong1);
                  +
                  149 TWO_COMPONENT_ACCESS (long long int, ulong2);
                  +
                  150 THREE_COMPONENT_ACCESS(long long int, ulong3);
                  +
                  151 FOUR_COMPONENT_ACCESS (long long int, ulong4);
                  +
                  152 
                  +
                  153 ONE_COMPONENT_ACCESS (long long int, longlong1);
                  +
                  154 TWO_COMPONENT_ACCESS (long long int, longlong2);
                  +
                  155 THREE_COMPONENT_ACCESS(long long int, longlong3);
                  +
                  156 FOUR_COMPONENT_ACCESS (long long int, longlong4);
                  157 
                  -
                  158 ONE_COMPONENT_ACCESS (unsigned short, ushort1);
                  -
                  159 TWO_COMPONENT_ACCESS (unsigned short, ushort2);
                  -
                  160 THREE_COMPONENT_ACCESS(unsigned short, ushort3);
                  -
                  161 FOUR_COMPONENT_ACCESS (unsigned short, ushort4);
                  -
                  162 
                  -
                  163 ONE_COMPONENT_ACCESS (unsigned int, uint1);
                  -
                  164 TWO_COMPONENT_ACCESS (unsigned int, uint2);
                  -
                  165 THREE_COMPONENT_ACCESS(unsigned int, uint3);
                  -
                  166 FOUR_COMPONENT_ACCESS (unsigned int, uint4);
                  -
                  167 
                  -
                  168 ONE_COMPONENT_ACCESS (unsigned long int, ulong1);
                  -
                  169 TWO_COMPONENT_ACCESS (unsigned long int, ulong2);
                  -
                  170 THREE_COMPONENT_ACCESS(unsigned long int, ulong3);
                  -
                  171 FOUR_COMPONENT_ACCESS (unsigned long int, ulong4);
                  -
                  172 
                  -
                  173 ONE_COMPONENT_ACCESS (unsigned long long int, ulong1);
                  -
                  174 TWO_COMPONENT_ACCESS (unsigned long long int, ulong2);
                  -
                  175 THREE_COMPONENT_ACCESS(unsigned long long int, ulong3);
                  -
                  176 FOUR_COMPONENT_ACCESS (unsigned long long int, ulong4);
                  -
                  177 
                  -
                  178 ONE_COMPONENT_ACCESS (unsigned long long int, ulonglong1);
                  -
                  179 TWO_COMPONENT_ACCESS (unsigned long long int, ulonglong2);
                  -
                  180 THREE_COMPONENT_ACCESS(unsigned long long int, ulonglong3);
                  -
                  181 FOUR_COMPONENT_ACCESS (unsigned long long int, ulonglong4);
                  -
                  182 
                  -
                  183 
                  -
                  184 //Floating point
                  -
                  185 ONE_COMPONENT_ACCESS (float, float1);
                  -
                  186 TWO_COMPONENT_ACCESS (float, float2);
                  -
                  187 THREE_COMPONENT_ACCESS(float, float3);
                  -
                  188 FOUR_COMPONENT_ACCESS (float, float4);
                  +
                  158 
                  +
                  159 // unsigned:
                  +
                  160 ONE_COMPONENT_ACCESS (unsigned char, uchar1);
                  +
                  161 TWO_COMPONENT_ACCESS (unsigned char, uchar2);
                  +
                  162 THREE_COMPONENT_ACCESS(unsigned char, uchar3);
                  +
                  163 FOUR_COMPONENT_ACCESS (unsigned char, uchar4);
                  +
                  164 
                  +
                  165 ONE_COMPONENT_ACCESS (unsigned short, ushort1);
                  +
                  166 TWO_COMPONENT_ACCESS (unsigned short, ushort2);
                  +
                  167 THREE_COMPONENT_ACCESS(unsigned short, ushort3);
                  +
                  168 FOUR_COMPONENT_ACCESS (unsigned short, ushort4);
                  +
                  169 
                  +
                  170 ONE_COMPONENT_ACCESS (unsigned int, uint1);
                  +
                  171 TWO_COMPONENT_ACCESS (unsigned int, uint2);
                  +
                  172 THREE_COMPONENT_ACCESS(unsigned int, uint3);
                  +
                  173 FOUR_COMPONENT_ACCESS (unsigned int, uint4);
                  +
                  174 
                  +
                  175 ONE_COMPONENT_ACCESS (unsigned long int, ulong1);
                  +
                  176 TWO_COMPONENT_ACCESS (unsigned long int, ulong2);
                  +
                  177 THREE_COMPONENT_ACCESS(unsigned long int, ulong3);
                  +
                  178 FOUR_COMPONENT_ACCESS (unsigned long int, ulong4);
                  +
                  179 
                  +
                  180 ONE_COMPONENT_ACCESS (unsigned long long int, ulong1);
                  +
                  181 TWO_COMPONENT_ACCESS (unsigned long long int, ulong2);
                  +
                  182 THREE_COMPONENT_ACCESS(unsigned long long int, ulong3);
                  +
                  183 FOUR_COMPONENT_ACCESS (unsigned long long int, ulong4);
                  +
                  184 
                  +
                  185 ONE_COMPONENT_ACCESS (unsigned long long int, ulonglong1);
                  +
                  186 TWO_COMPONENT_ACCESS (unsigned long long int, ulonglong2);
                  +
                  187 THREE_COMPONENT_ACCESS(unsigned long long int, ulonglong3);
                  +
                  188 FOUR_COMPONENT_ACCESS (unsigned long long int, ulonglong4);
                  189 
                  -
                  190 ONE_COMPONENT_ACCESS (double, double1);
                  -
                  191 TWO_COMPONENT_ACCESS (double, double2);
                  -
                  192 THREE_COMPONENT_ACCESS(double, double3);
                  -
                  193 FOUR_COMPONENT_ACCESS (double, double4);
                  -
                  #define ONE_COMPONENT_ACCESS(T, VT)
                  Definition: hip_vector_types.h:114
                  +
                  190 
                  +
                  191 //Floating point
                  +
                  192 ONE_COMPONENT_ACCESS (float, float1);
                  +
                  193 TWO_COMPONENT_ACCESS (float, float2);
                  +
                  194 THREE_COMPONENT_ACCESS(float, float3);
                  +
                  195 FOUR_COMPONENT_ACCESS (float, float4);
                  +
                  196 
                  +
                  197 ONE_COMPONENT_ACCESS (double, double1);
                  +
                  198 TWO_COMPONENT_ACCESS (double, double2);
                  +
                  199 THREE_COMPONENT_ACCESS(double, double3);
                  +
                  200 FOUR_COMPONENT_ACCESS (double, double4);
                  +
                  201 
                  +
                  202 
                  +
                  203 #endif
                  +
                  204 
                  +
                  #define ONE_COMPONENT_ACCESS(T, VT)
                  Definition: hip_vector_types.h:121
                  diff --git a/docs/RuntimeAPI/html/hierarchy.html b/docs/RuntimeAPI/html/hierarchy.html index ca624bc669..098a24842c 100644 --- a/docs/RuntimeAPI/html/hierarchy.html +++ b/docs/RuntimeAPI/html/hierarchy.html @@ -91,27 +91,33 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  [detail level 12]

                  @@ -444,7 +443,7 @@ Functions

                  - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
                  oCdim3
                  oCexception
                  |oCihipException
                  |\CihipException
                  oCFakeMutex
                  oChipChannelFormatDesc
                  oChipDeviceArch_t
                  oChipDeviceProp_t
                  oChipEvent_t
                  oChipPointerAttribute_t
                  oCihipDevice_t
                  oCihipEvent_t
                  oCihipSignal_t
                  oCihipStream_t
                  oCStagingBuffer
                  \CtextureReference
                   \Ctexture< T, texType, hipTextureReadMode >
                  |\CihipException
                  oCFakeMutex
                  oChipChannelFormatDesc
                  oChipDeviceArch_t
                  oChipDeviceProp_t
                  oChipEvent_t
                  oChipPointerAttribute_t
                  oCihipDevice_t
                  oCihipEvent_t
                  oCihipSignal_t
                  oCihipStream_t
                  oCLockedAccessor< T >
                  oCLockedBase< MUTEX_TYPE >
                  |oCihipDeviceCriticalBase_t< MUTEX_TYPE >
                  |\CihipStreamCriticalBase_t< MUTEX_TYPE >
                  oCLockedBase< DeviceMutex >
                  |\CihipDeviceCriticalBase_t< DeviceMutex >
                  oCLockedBase< StreamMutex >
                  |\CihipStreamCriticalBase_t< StreamMutex >
                  oCStagingBuffer
                  \CtextureReference
                  diff --git a/docs/RuntimeAPI/html/hip__common_8h_source.html b/docs/RuntimeAPI/html/hip__common_8h_source.html index 55d079f9f9..d0c7252e3a 100644 --- a/docs/RuntimeAPI/html/hip__common_8h_source.html +++ b/docs/RuntimeAPI/html/hip__common_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hip_common.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hip_common.h Source File @@ -123,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  32 #define __HIP_PLATFORM_HCC__
                  33 #define __HIPCC__
                  34 
                  -
                  35 #if defined(__HCC_ACCELERATOR__) and (__HCC_ACCELERATOR__ != 0)
                  +
                  35 #if defined(__HCC_ACCELERATOR__) && (__HCC_ACCELERATOR__ != 0)
                  36 #define __HIP_DEVICE_COMPILE__ 1
                  37 #else
                  38 #define __HIP_DEVICE_COMPILE__ 0
                  @@ -137,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  46 # define __HIPCC__
                  47 # endif
                  48 
                  -
                  49 #if defined(__CUDA_ARCH__) and (__CUDA_ARCH__ != 0)
                  +
                  49 #if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ != 0)
                  50 #define __HIP_DEVICE_COMPILE__ 1
                  51 #else
                  52 #define __HIP_DEVICE_COMPILE__ 0
                  @@ -181,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hip__hcc_8cpp.html b/docs/RuntimeAPI/html/hip__hcc_8cpp.html index f2cf85359c..e009208110 100644 --- a/docs/RuntimeAPI/html/hip__hcc_8cpp.html +++ b/docs/RuntimeAPI/html/hip__hcc_8cpp.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/src/hip_hcc.cpp File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/src/hip_hcc.cpp File Reference @@ -86,10 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  @@ -109,172 +106,32 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); #include <hc.hpp>
                  #include <hc_am.hpp>
                  #include "hip_runtime.h"
                  +#include "hcc_detail/hip_hcc.h"
                  #include "hsa_ext_amd.h"
                  -#include "hcc_detail/staging_buffer.h"
                  #include "hcc_detail/trace_helper.h"
                  -#include "staging_buffer.cpp"
                  - - - - - - - - - - - - - -

                  -Classes

                  class  ihipException
                   
                  struct  ihipSignal_t
                   
                  class  FakeMutex
                   
                  class  ihipStream_t
                   
                  struct  ihipEvent_t
                   
                  struct  ihipDevice_t
                   
                  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

                  Macros

                  #define HIP_HCC
                   
                  -#define USE_AV_COPY   0
                   
                  -#define INLINE   static inline
                   
                  -#define KNRM   "\x1B[0m"
                   
                  -#define KRED   "\x1B[31m"
                   
                  -#define KGRN   "\x1B[32m"
                   
                  -#define KYEL   "\x1B[33m"
                   
                  -#define KBLU   "\x1B[34m"
                   
                  -#define KMAG   "\x1B[35m"
                   
                  -#define KCYN   "\x1B[36m"
                   
                  -#define KWHT   "\x1B[37m"
                   
                  -#define API_COLOR   KGRN
                   
                  -#define HIP_HCC
                   
                  -#define STREAM_THREAD_SAFE   1
                   
                  -#define FORCE_SAMEDIR_COPY_DEP   1
                   
                  -#define COMPILE_HIP_DB   1
                   
                  -#define COMPILE_HIP_TRACE_API   0x3
                   
                  -#define COMPILE_TRACE_MARKER   0
                   
                  -#define ONE_OBJECT_FILE   1
                   
                  -#define SCOPED_MARKER(markerName, group, userString)
                   
                  #define API_TRACE(...)
                   
                  #define HIP_INIT_API(...)
                   
                  -#define DB_API   0 /* 0x01 - shortcut to enable HIP_TRACE_API on single switch */
                   
                  -#define DB_SYNC   1 /* 0x02 - trace synchronization pieces */
                   
                  -#define DB_MEM   2 /* 0x04 - trace memory allocation / deallocation */
                   
                  -#define DB_COPY1   3 /* 0x08 - trace memory copy commands. . */
                   
                  -#define DB_SIGNAL   4 /* 0x10 - trace signal pool commands */
                   
                  -#define DB_COPY2   5 /* 0x20 - trace memory copy commands. Detailed. */
                   
                  #define tprintf(trace_level,...)
                   
                  #define DeviceErrorCheck(x)   if (x != HSA_STATUS_SUCCESS) { return hipErrorInvalidDevice; }
                   
                  #define ErrorCheck(x)   error_check(x, __LINE__, __FILE__)
                   
                  #define ihipLogStatus(_hip_status)
                   
                  #define READ_ENV_I(_build, _ENV_VAR, _ENV_VAR2, _description)
                   
                  - - - - - -

                  -Typedefs

                  -typedef uint64_t SIGSEQNUM
                   
                  -typedef std::mutex StreamMutex
                   
                  - - - - - -

                  -Enumerations

                  enum  ihipCommand_t {
                  -  ihipCommandCopyH2H, -ihipCommandCopyH2D, -ihipCommandCopyD2H, -ihipCommandCopyD2D, -
                  -  ihipCommandKernel, -ihipCommandCopyH2H, -ihipCommandCopyH2D, -ihipCommandCopyD2H, -
                  -  ihipCommandCopyD2D, -ihipCommandKernel -
                  - }
                   
                  enum  hipEventStatus_t {
                  -  hipEventStatusUnitialized = 0, -hipEventStatusCreated = 1, -hipEventStatusRecording = 2, -hipEventStatusRecorded = 3, -
                  -  hipEventStatusUnitialized = 0, -hipEventStatusCreated = 1, -hipEventStatusRecording = 2, -hipEventStatusRecorded = 3 -
                  - }
                   
                  - - - - + + + @@ -287,12 +144,12 @@ void  - - - - + + + + @@ -302,190 +159,31 @@ hipStream_t  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +

                  Functions

                  +
                  const char * ihipErrorString (hipError_t hip_error)
                   
                  -INLINE bool ihipIsValidDevice (unsigned deviceIndex)
                   
                   
                  +bool ihipIsValidDevice (unsigned deviceIndex)
                   
                  void error_check (hsa_status_t hsa_error_code, int line_num, std::string str)
                   
                  ihipReadEnv_I (in
                  void ihipInit ()
                   
                  -INLINE ihipDevice_tihipGetTlsDefaultDevice ()
                   
                  -INLINE ihipDevice_tihipGetDevice (int deviceId)
                   
                  +ihipDevice_tihipGetTlsDefaultDevice ()
                   
                  +ihipDevice_tihipGetDevice (int deviceId)
                   
                  hipStream_t ihipSyncAndResolveStream (hipStream_t stream)
                   
                  ihipPreLaunchK
                  void ihipPostLaunchKernel (hipStream_t stream, hc::completion_future &kernelFuture)
                   
                  hipError_t hipGetDevice (int *device)
                   Return the default device id for the calling host thread. More...
                   
                  hipError_t hipGetDeviceCount (int *count)
                   Return number of compute-capable devices. More...
                   
                  hipError_t hipDeviceSetCacheConfig (hipFuncCache cacheConfig)
                   Set L1/Shared cache partition. More...
                   
                  hipError_t hipDeviceGetCacheConfig (hipFuncCache *cacheConfig)
                   Set Cache configuration for a specific function. More...
                   
                  hipError_t hipFuncSetCacheConfig (hipFuncCache cacheConfig)
                   Set Cache configuration for a specific function. More...
                   
                  hipError_t hipDeviceSetSharedMemConfig (hipSharedMemConfig config)
                   Set Shared memory bank configuration. More...
                   
                  hipError_t hipDeviceGetSharedMemConfig (hipSharedMemConfig *pConfig)
                   Get Shared memory bank configuration. More...
                   
                  hipError_t hipSetDevice (int device)
                   Set default device to be used for subsequent hip API calls from this thread. More...
                   
                  hipError_t hipDeviceSynchronize (void)
                   Blocks until the default device has completed all preceding requested tasks. More...
                   
                  hipError_t hipDeviceReset (void)
                   Destroy all resources and reset all state on the default device in the current process. More...
                   
                  hipError_t hipDeviceGetAttribute (int *pi, hipDeviceAttribute_t attr, int device)
                   Query device attribute. More...
                   
                  hipError_t hipGetDeviceProperties (hipDeviceProp_t *props, int device)
                   Returns device properties. More...
                   
                  hipError_t hipGetLastError ()
                   Return last error returned by any HIP runtime API call and resets the stored error code to hipSuccess. More...
                   
                  -hipError_t hipPeakAtLastError ()
                   
                  const char * hipGetErrorName (hipError_t hip_error)
                   Return name of the specified error code in text form. More...
                   
                  const char * hipGetErrorString (hipError_t hip_error)
                   Return handy text string message to explain the error which occurred. More...
                   
                  hipError_t hipStreamCreateWithFlags (hipStream_t *stream, unsigned int flags)
                   Create an asynchronous stream. More...
                   
                  hipError_t hipStreamWaitEvent (hipStream_t stream, hipEvent_t event, unsigned int flags)
                   Make the specified compute stream wait for an event. More...
                   
                  hipError_t hipStreamSynchronize (hipStream_t stream)
                   Wait for all commands in stream to complete. More...
                   
                  hipError_t hipStreamDestroy (hipStream_t stream)
                   Destroys the specified stream. More...
                   
                  hipError_t hipStreamGetFlags (hipStream_t stream, unsigned int *flags)
                   Return flags associated with this stream. More...
                   
                  hipError_t hipEventCreateWithFlags (hipEvent_t *event, unsigned flags)
                   Create an event with the specified flags. More...
                   
                  hipError_t hipEventRecord (hipEvent_t event, hipStream_t stream)
                   Record an event in the specified stream. More...
                   
                  hipError_t hipEventDestroy (hipEvent_t event)
                   Destroy the specified event. More...
                   
                  hipError_t hipEventSynchronize (hipEvent_t event)
                   : Wait for an event to complete. More...
                   
                  void ihipSetTs (hipEvent_t e)
                   
                  hipError_t hipEventElapsedTime (float *ms, hipEvent_t start, hipEvent_t stop)
                   Return the elapsed time between two events. More...
                   
                  hipError_t hipEventQuery (hipEvent_t event)
                   Query event status. More...
                   
                  hipError_t hipPointerGetAttributes (hipPointerAttribute_t *attributes, void *ptr)
                   Return attributes for the specified pointer. More...
                   
                  hipError_t hipHostGetDevicePointer (void **devicePointer, void *hostPointer, unsigned flags)
                   
                  -template<typename T >
                  hc::completion_future ihipMemcpyKernel (hipStream_t stream, T *c, const T *a, size_t sizeBytes)
                   
                  -template<typename T >
                  hc::completion_future ihipMemsetKernel (hipStream_t stream, T *ptr, T val, size_t sizeBytes)
                   
                  hipError_t hipMalloc (void **ptr, size_t sizeBytes)
                   Allocate memory on the default accelerator. More...
                   
                  hipError_t hipMallocHost (void **ptr, size_t sizeBytes)
                   Allocate pinned host memory. More...
                   
                  hipError_t hipHostMalloc (void **ptr, size_t sizeBytes, unsigned int flags)
                   Allocate device accessible page locked host memory. More...
                   
                  -hipError_t hipHostAlloc (void **ptr, size_t sizeBytes, unsigned int flags)
                   
                  hipError_t hipHostGetFlags (unsigned int *flagsPtr, void *hostPtr)
                   Get flags associated with host pointer. More...
                   
                  hipError_t hipHostRegister (void *hostPtr, size_t sizeBytes, unsigned int flags)
                   Register host memory so it can be accessed from the current device. More...
                   
                  hipError_t hipHostUnregister (void *hostPtr)
                   Un-register host pointer. More...
                   
                  hipError_t hipMemcpyToSymbol (const char *symbolName, const void *src, size_t count, size_t offset, hipMemcpyKind kind)
                   Copies sizeBytes bytes from the memory area pointed to by src to the memory area pointed to by offset bytes from the start of symbol symbol. More...
                   
                  hipError_t hipMemcpy (void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind)
                   Copy data from src to dst. More...
                   
                  hipError_t hipMemcpyAsync (void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream)
                   Copy data from src to dst asynchronously. More...
                   
                  hipError_t hipMemsetAsync (void *dst, int value, size_t sizeBytes, hipStream_t stream)
                   Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value value. More...
                   
                  hipError_t hipMemset (void *dst, int value, size_t sizeBytes)
                   Copy data from src to dst asynchronously. More...
                   
                  hipError_t hipMemGetInfo (size_t *free, size_t *total)
                   Query memory info. Return snapshot of free memory, and total allocatable memory on the device. More...
                   
                  hipError_t hipFree (void *ptr)
                   Free memory allocated by the hcc hip memory allocation API. This API performs an implicit hipDeviceSynchronize() call. More...
                   
                  hipError_t hipHostFree (void *ptr)
                   Free memory allocated by the hcc hip host memory allocation API. More...
                   
                  hipError_t hipFreeHost (void *ptr)
                   Free memory allocated by the hcc hip host memory allocation API. More...
                   
                  hipError_t hipDeviceCanAccessPeer (int *canAccessPeer, int device, int peerDevice)
                   Determine if a device can access a peer's memory. More...
                   
                  hipError_t hipDeviceDisablePeerAccess (int peerDevice)
                   Disables registering memory on peerDevice for direct access from the current device. More...
                   
                  hipError_t hipDeviceEnablePeerAccess (int peerDevice, unsigned int flags)
                   Enables registering memory on peerDevice for direct access from the current device. More...
                   
                  hipError_t hipMemcpyPeer (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes)
                   Copies memory from one device to memory on another device. More...
                   
                  hipError_t hipMemcpyPeerAsync (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream)
                   Copies memory from one device to memory on another device. More...
                   
                  hipError_t hipDriverGetVersion (int *driverVersion)
                   Returns the approximate HIP driver version. More...
                   
                  hipError_t hipHccGetAccelerator (int deviceId, hc::accelerator *acc)
                   Return hc::accelerator associated with the specified deviceId. More...
                   
                  hipError_t hipHccGetAcceleratorView (hipStream_t stream, hc::accelerator_view **av)
                   Return hc::accelerator_view associated with the specified stream. More...
                   
                  hipError_t hipHccGetAccelerator (int deviceId, hc::accelerator *acc)
                   
                  hipError_t hipHccGetAcceleratorView (hipStream_t stream, hc::accelerator_view **av)
                   
                  - - - - - - - - - + + + + + + + + + + @@ -510,24 +208,17 @@ int  - - - - - - - - + + +ihipDevice_t *  @@ -545,73 +236,6 @@ hsa_agent_t  - -

                  Variables

                  -int HIP_LAUNCH_BLOCKING = 0
                   Make all HIP APIs host-synchronous.
                   
                  -int HIP_PRINT_ENV = 0
                   Print all HIP-related environment variables.
                   
                  -int HIP_TRACE_API = 0
                   Trace HIP APIs.
                   
                  +const int release = 1
                   
                  +int HIP_LAUNCH_BLOCKING = 0
                   
                  +int HIP_PRINT_ENV = 0
                   
                  +int HIP_TRACE_API = 0
                   
                  +int HIP_ATP_MARKER = 0
                   
                  int HIP_DB = 0
                   
                  HIP_DISABLE_HW_KERNEL_
                  int HIP_DISABLE_HW_COPY_DEP = 1
                   
                  const char * dbName []
                   
                  -const hipStream_t hipStreamNull = 0x0
                   
                  const char * ihipCommandName []
                   
                  -thread_local hipError_t tls_lastHipError = hipSuccess
                   
                  thread_local int tls_defaultDevice = 0
                   
                  +thread_local hipError_t tls_lastHipError = hipSuccess
                   
                  std::once_flag hip_initialized
                   
                  -ihipDevice_tg_devices
                  g_devices
                   
                  bool g_visible_device = false
                  g_cpu_agent

                  Detailed Description

                  Contains definitions for functions that are large enough that we don't want to inline them everywhere. This file is compiled and linked into apps running HIP / HCC path.

                  Macro Definition Documentation

                  - -
                  -
                  - - - - - - - - -
                  #define API_TRACE( ...)
                  -
                  -Value:
                  {\
                  -
                  std::string s = std::string(__func__) + " (" + ToString(__VA_ARGS__) + ')';\
                  -
                  if (COMPILE_HIP_DB && HIP_TRACE_API) {\
                  -
                  fprintf (stderr, API_COLOR "<<hip-api: %s\n" KNRM, s.c_str());\
                  -
                  }\
                  -
                  SCOPED_MARKER(s.c_str(), "HIP", NULL);\
                  -
                  }
                  -
                  int HIP_TRACE_API
                  Trace HIP APIs.
                  Definition: hip_hcc.cpp:73
                  -
                  -
                  -
                  - -
                  -
                  - - - - - - - - -
                  #define HIP_INIT_API( ...)
                  -
                  -Value:
                  std::call_once(hip_initialized, ihipInit);\
                  -
                  API_TRACE(__VA_ARGS__);
                  -
                  -
                  -
                  - -
                  -
                  - - - - - - - - -
                  #define ihipLogStatus( _hip_status)
                  -
                  -Value:
                  ({\
                  -
                  tls_lastHipError = _hip_status;\
                  -
                  \
                  -
                  if ((COMPILE_HIP_TRACE_API & 0x2) && HIP_TRACE_API) {\
                  -
                  fprintf(stderr, " %ship-api: %-30s ret=%2d (%s)>>\n" KNRM, (_hip_status == 0) ? API_COLOR:KRED, __func__, _hip_status, ihipErrorString(_hip_status));\
                  -
                  }\
                  -
                  _hip_status;\
                  -
                  })
                  -
                  int HIP_TRACE_API
                  Trace HIP APIs.
                  Definition: hip_hcc.cpp:73
                  -
                  -
                  -
                  @@ -653,61 +277,22 @@ hsa_agent_t 
                  g_cpu_agent - -
                  -
                  - - - - - - - - - - - - - - - - - - -
                  #define tprintf( trace_level,
                   ... 
                  )
                  -
                  -Value:
                  {\
                  -
                  if (HIP_DB & (1<<(trace_level))) {\
                  -
                  fprintf (stderr, " %s:", dbName[trace_level]); \
                  -
                  fprintf (stderr, __VA_ARGS__);\
                  -
                  fprintf (stderr, "%s", KNRM); \
                  -
                  }\
                  -
                  }
                  -
                  -
                  -

                  Function Documentation

                  - +
                  - + - - + + - - - - - - - - + + @@ -716,55 +301,41 @@ hsa_agent_t 
                  hipError_t hipHostGetDevicePointer hipError_t hipHccGetAccelerator (void ** devicePointer, int deviceId,
                  void * hostPointer,
                  unsigned flags hc::accelerator * acc 
                  g_cpu_agent
                  -
                  Returns
                  hipSuccess,
                  -
                  -hipErrorInvalidValue if flags are not 0
                  -
                  -hipErrorMemoryAllocation if hostPointer is not a tracked allocation.
                  +
                  Returns
                  hipSuccess, hipErrorInvalidDevice
                  -

                  Variable Documentation

                  - +
                  - + + + + -
                  const char* dbName[]hipError_t hipHccGetAcceleratorView (hipStream_t stream,
                  -
                  -Initial value:
                  =
                  -
                  {
                  -
                  KNRM "hip-api",
                  -
                  KYEL "hip-sync",
                  -
                  KCYN "hip-mem",
                  -
                  KMAG "hip-copy1",
                  -
                  KRED "hip-signal",
                  -
                  KNRM "hip-copy2",
                  -
                  }
                  -
                  -
                  -
                  - -
                  -
                  - - + + + + + + + + +
                  const char* ihipCommandName[]hc::accelerator_view ** av 
                  )
                  -Initial value:
                  = {
                  -
                  "CopyH2H", "CopyH2D", "CopyD2H", "CopyD2D", "Kernel"
                  -
                  }
                  -
                  +
                  Returns
                  hipSuccess
                  +
                  diff --git a/docs/RuntimeAPI/html/hip__hcc_8h_source.html b/docs/RuntimeAPI/html/hip__hcc_8h_source.html new file mode 100644 index 0000000000..55c1a023fa --- /dev/null +++ b/docs/RuntimeAPI/html/hip__hcc_8h_source.html @@ -0,0 +1,815 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h Source File + + + + + + + + + +
                  +
                  + + + + + + +
                  +
                  HIP: Heterogenous-computing Interface for Portability +
                  +
                  +
                  + + + + + + + + + +
                  + +
                  + + +
                  +
                  +
                  +
                  hip_hcc.h
                  +
                  +
                  +
                  1 /*
                  +
                  2 Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
                  +
                  3 Permission is hereby granted, free of charge, to any person obtaining a copy
                  +
                  4 of this software and associated documentation files (the "Software"), to deal
                  +
                  5 in the Software without restriction, including without limitation the rights
                  +
                  6 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                  +
                  7 copies of the Software, and to permit persons to whom the Software is
                  +
                  8 furnished to do so, subject to the following conditions:
                  +
                  9 The above copyright notice and this permission notice shall be included in
                  +
                  10 all copies or substantial portions of the Software.
                  +
                  11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR
                  +
                  12 IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                  +
                  13 FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
                  +
                  14 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER
                  +
                  15 LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                  +
                  16 OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
                  +
                  17 THE SOFTWARE.
                  +
                  18 */
                  +
                  19 
                  +
                  20 #ifndef HIP_HCC_H
                  +
                  21 #define HIP_HCC_H
                  +
                  22 
                  +
                  23 #include <hc.hpp>
                  +
                  24 #include "hcc_detail/hip_util.h"
                  +
                  25 #include "hcc_detail/staging_buffer.h"
                  +
                  26 
                  +
                  27 #define HIP_HCC
                  +
                  28 
                  +
                  29 #if defined(__HCC__) && (__hcc_workweek__ < 1502)
                  +
                  30 #error("This version of HIP requires a newer version of HCC.");
                  +
                  31 #endif
                  +
                  32 
                  +
                  33 // #define USE_MEMCPYTOSYMBOL
                  +
                  34 //
                  +
                  35 //Use the new HCC accelerator_view::copy instead of am_copy
                  +
                  36 #define USE_AV_COPY 0
                  +
                  37 
                  +
                  38 // Compile peer-to-peer support.
                  +
                  39 // >= 2 : use HCC hc:accelerator::get_is_peer
                  +
                  40 // >= 3 : use hc::am_memtracker_update_peers(...)
                  +
                  41 #define USE_PEER_TO_PEER 0
                  +
                  42 
                  +
                  43 // Use new lock API in HCC:
                  +
                  44 #define USE_HCC_LOCK 0
                  +
                  45 
                  +
                  46 //#define INLINE static inline
                  +
                  47 
                  +
                  48 //---
                  +
                  49 // Environment variables:
                  +
                  50 
                  +
                  51 // Intended to distinguish whether an environment variable should be visible only in debug mode, or in debug+release.
                  +
                  52 //static const int debug = 0;
                  +
                  53 extern const int release;
                  +
                  54 
                  +
                  55 extern int HIP_LAUNCH_BLOCKING;
                  +
                  56 
                  +
                  57 extern int HIP_PRINT_ENV;
                  +
                  58 extern int HIP_ATP_MARKER;
                  +
                  59 //extern int HIP_TRACE_API;
                  +
                  60 extern int HIP_ATP;
                  +
                  61 extern int HIP_DB;
                  +
                  62 extern int HIP_STAGING_SIZE; /* size of staging buffers, in KB */
                  +
                  63 extern int HIP_STAGING_BUFFERS; // TODO - remove, two buffers should be enough.
                  +
                  64 extern int HIP_PININPLACE;
                  +
                  65 extern int HIP_STREAM_SIGNALS; /* number of signals to allocate at stream creation */
                  +
                  66 extern int HIP_VISIBLE_DEVICES; /* Contains a comma-separated sequence of GPU identifiers */
                  +
                  67 
                  +
                  68 
                  +
                  69 //---
                  +
                  70 // Chicken bits for disabling functionality to work around potential issues:
                  +
                  71 extern int HIP_DISABLE_HW_KERNEL_DEP;
                  +
                  72 extern int HIP_DISABLE_HW_COPY_DEP;
                  +
                  73 
                  +
                  74 extern thread_local int tls_defaultDevice;
                  +
                  75 extern thread_local hipError_t tls_lastHipError;
                  +
                  76 class ihipStream_t;
                  +
                  77 class ihipDevice_t;
                  +
                  78 
                  +
                  79 
                  +
                  80 // Color defs for debug messages:
                  +
                  81 #define KNRM "\x1B[0m"
                  +
                  82 #define KRED "\x1B[31m"
                  +
                  83 #define KGRN "\x1B[32m"
                  +
                  84 #define KYEL "\x1B[33m"
                  +
                  85 #define KBLU "\x1B[34m"
                  +
                  86 #define KMAG "\x1B[35m"
                  +
                  87 #define KCYN "\x1B[36m"
                  +
                  88 #define KWHT "\x1B[37m"
                  +
                  89 
                  +
                  90 #define API_COLOR KGRN
                  +
                  91 
                  +
                  92 
                  +
                  93 #define HIP_HCC
                  +
                  94 
                  +
                  95 // If set, thread-safety is enforced on all stream functions.
                  +
                  96 // Stream functions will acquire a mutex before entering critical sections.
                  +
                  97 #define STREAM_THREAD_SAFE 1
                  +
                  98 
                  +
                  99 
                  +
                  100 #define DEVICE_THREAD_SAFE 1
                  +
                  101 
                  +
                  102 // If FORCE_COPY_DEP=1 , HIP runtime will add
                  +
                  103 // synchronization for copy commands in the same stream, regardless of command type.
                  +
                  104 // If FORCE_COPY_DEP=0 data copies of the same kind (H2H, H2D, D2H, D2D) are assumed to be implicitly ordered.
                  +
                  105 // ROCR runtime implementation currently provides this guarantee when using SDMA queues but not
                  +
                  106 // when using shader queues.
                  +
                  107 // TODO - measure if this matters for performance, in particular for back-to-back small copies.
                  +
                  108 // If not, we can simplify the copy dependency tracking by collapsing to a single Copy type, and always forcing dependencies for copy commands.
                  +
                  109 #define FORCE_SAMEDIR_COPY_DEP 1
                  +
                  110 
                  +
                  111 
                  +
                  112 // Compile debug trace mode - this prints debug messages to stderr when env var HIP_DB is set.
                  +
                  113 // May be set to 0 to remove debug if checks - possible code size and performance difference?
                  +
                  114 #define COMPILE_HIP_DB 1
                  +
                  115 
                  +
                  116 
                  +
                  117 // Compile HIP tracing capability.
                  +
                  118 // 0x1 = print a string at function entry with arguments.
                  +
                  119 // 0x2 = prints a simple message with function name + return code when function exits.
                  +
                  120 // 0x3 = print both.
                  +
                  121 // Must be enabled at runtime with HIP_TRACE_API
                  +
                  122 #define COMPILE_HIP_TRACE_API 0x3
                  +
                  123 
                  +
                  124 
                  +
                  125 // Compile code that generates trace markers for CodeXL ATP at HIP function begin/end.
                  +
                  126 // ATP is standard CodeXL format that includes timestamps for kernels, HSA RT APIs, and HIP APIs.
                  +
                  127 #ifndef COMPILE_HIP_ATP_MARKER
                  +
                  128 #define COMPILE_HIP_ATP_MARKER 0
                  +
                  129 #endif
                  +
                  130 
                  +
                  131 
                  +
                  132 // #include CPP files to produce one object file
                  +
                  133 #define ONE_OBJECT_FILE 0
                  +
                  134 
                  +
                  135 
                  +
                  136 // Compile support for trace markers that are displayed on CodeXL GUI at start/stop of each function boundary.
                  +
                  137 // TODO - currently we print the trace message at the beginning. if we waited, we could also include return codes, and any values returned
                  +
                  138 // through ptr-to-args (ie the pointers allocated by hipMalloc).
                  +
                  139 #if COMPILE_HIP_ATP_MARKER
                  +
                  140 #include "AMDTActivityLogger.h"
                  +
                  141 #define SCOPED_MARKER(markerName,group,userString) amdtScopedMarker(markerName, group, userString)
                  +
                  142 #else
                  +
                  143 // Swallow scoped markers:
                  +
                  144 #define SCOPED_MARKER(markerName,group,userString)
                  +
                  145 #endif
                  +
                  146 
                  +
                  147 
                  +
                  148 #if COMPILE_HIP_ATP_MARKER || (COMPILE_HIP_TRACE_API & 0x1)
                  +
                  149 #define API_TRACE(...)\
                  +
                  150 {\
                  +
                  151  if (HIP_ATP_MARKER || (COMPILE_HIP_DB && HIP_TRACE_API)) {\
                  +
                  152  std::string s = std::string(__func__) + " (" + ToString(__VA_ARGS__) + ')';\
                  +
                  153  if (COMPILE_HIP_DB && HIP_TRACE_API) {\
                  +
                  154  fprintf (stderr, API_COLOR "<<hip-api: %s\n" KNRM, s.c_str());\
                  +
                  155  }\
                  +
                  156  SCOPED_MARKER(s.c_str(), "HIP", NULL);\
                  +
                  157  }\
                  +
                  158 }
                  +
                  159 #else
                  +
                  160 // Swallow API_TRACE
                  +
                  161 #define API_TRACE(...)
                  +
                  162 #endif
                  +
                  163 
                  +
                  164 
                  +
                  165 
                  +
                  166 // This macro should be called at the beginning of every HIP API.
                  +
                  167 // It initialies the hip runtime (exactly once), and
                  +
                  168 // generate trace string that can be output to stderr or to ATP file.
                  +
                  169 #define HIP_INIT_API(...) \
                  +
                  170  std::call_once(hip_initialized, ihipInit);\
                  +
                  171  API_TRACE(__VA_ARGS__);
                  +
                  172 
                  +
                  173 #define ihipLogStatus(_hip_status) \
                  +
                  174  ({\
                  +
                  175  hipError_t _local_hip_status = _hip_status; /*local copy so _hip_status only evaluated once*/ \
                  +
                  176  tls_lastHipError = _local_hip_status;\
                  +
                  177  \
                  +
                  178  if ((COMPILE_HIP_TRACE_API & 0x2) && HIP_TRACE_API) {\
                  +
                  179  fprintf(stderr, " %ship-api: %-30s ret=%2d (%s)>>\n" KNRM, (_local_hip_status == 0) ? API_COLOR:KRED, __func__, _local_hip_status, ihipErrorString(_local_hip_status));\
                  +
                  180  }\
                  +
                  181  _local_hip_status;\
                  +
                  182  })
                  +
                  183 
                  +
                  184 
                  +
                  185 
                  +
                  186 
                  +
                  187 //---
                  +
                  188 //HIP_DB Debug flags:
                  +
                  189 #define DB_API 0 /* 0x01 - shortcut to enable HIP_TRACE_API on single switch */
                  +
                  190 #define DB_SYNC 1 /* 0x02 - trace synchronization pieces */
                  +
                  191 #define DB_MEM 2 /* 0x04 - trace memory allocation / deallocation */
                  +
                  192 #define DB_COPY1 3 /* 0x08 - trace memory copy commands. . */
                  +
                  193 #define DB_SIGNAL 4 /* 0x10 - trace signal pool commands */
                  +
                  194 #define DB_COPY2 5 /* 0x20 - trace memory copy commands. Detailed. */
                  +
                  195 // When adding a new debug flag, also add to the char name table below.
                  +
                  196 
                  +
                  197 static const char *dbName [] =
                  +
                  198 {
                  +
                  199  KNRM "hip-api", // not used,
                  +
                  200  KYEL "hip-sync",
                  +
                  201  KCYN "hip-mem",
                  +
                  202  KMAG "hip-copy1",
                  +
                  203  KRED "hip-signal",
                  +
                  204  KNRM "hip-copy2",
                  +
                  205 };
                  +
                  206 
                  +
                  207 #if COMPILE_HIP_DB
                  +
                  208 #define tprintf(trace_level, ...) {\
                  +
                  209  if (HIP_DB & (1<<(trace_level))) {\
                  +
                  210  fprintf (stderr, " %s:", dbName[trace_level]); \
                  +
                  211  fprintf (stderr, __VA_ARGS__);\
                  +
                  212  fprintf (stderr, "%s", KNRM); \
                  +
                  213  }\
                  +
                  214 }
                  +
                  215 #else
                  +
                  216 /* Compile to empty code */
                  +
                  217 #define tprintf(trace_level, ...)
                  +
                  218 #endif
                  +
                  219 
                  +
                  220 class ihipException : public std::exception
                  +
                  221 {
                  +
                  222 public:
                  +
                  223  ihipException(hipError_t e) : _code(e) {};
                  +
                  224 
                  +
                  225  hipError_t _code;
                  +
                  226 };
                  +
                  227 
                  +
                  228 
                  +
                  229 #ifdef __cplusplus
                  +
                  230 extern "C" {
                  +
                  231 #endif
                  +
                  232 
                  +
                  233 typedef class ihipStream_t* hipStream_t;
                  +
                  234 //typedef struct hipEvent_t {
                  +
                  235 // struct ihipEvent_t *_handle;
                  +
                  236 //} hipEvent_t;
                  +
                  237 
                  +
                  238 #ifdef __cplusplus
                  +
                  239 }
                  +
                  240 #endif
                  +
                  241 
                  +
                  242 const hipStream_t hipStreamNull = 0x0;
                  +
                  243 
                  +
                  244 
                  +
                  245 enum ihipCommand_t {
                  +
                  246  ihipCommandCopyH2H,
                  +
                  247  ihipCommandCopyH2D,
                  +
                  248  ihipCommandCopyD2H,
                  +
                  249  ihipCommandCopyD2D,
                  +
                  250  ihipCommandKernel,
                  +
                  251 };
                  +
                  252 
                  +
                  253 static const char* ihipCommandName[] = {
                  +
                  254  "CopyH2H", "CopyH2D", "CopyD2H", "CopyD2D", "Kernel"
                  +
                  255 };
                  +
                  256 
                  +
                  257 
                  +
                  258 
                  +
                  259 typedef uint64_t SIGSEQNUM;
                  +
                  260 
                  +
                  261 //---
                  +
                  262 // Small wrapper around signals.
                  +
                  263 // Designed to be used from stream.
                  +
                  264 // TODO-someday refactor this class so it can be stored in a vector<>
                  +
                  265 // we already store the index here so we can use for garbage collection.
                  +
                  266 struct ihipSignal_t {
                  +
                  267  hsa_signal_t _hsa_signal; // hsa signal handle
                  +
                  268  int _index; // Index in pool, used for garbage collection.
                  +
                  269  SIGSEQNUM _sig_id; // unique sequentially increasing ID.
                  +
                  270 
                  +
                  271  ihipSignal_t();
                  +
                  272  ~ihipSignal_t();
                  +
                  273 
                  +
                  274  void release();
                  +
                  275 };
                  +
                  276 
                  +
                  277 
                  +
                  278 // Used to remove lock, for performance or stimulating bugs.
                  + +
                  280 {
                  +
                  281  public:
                  +
                  282  void lock() { }
                  +
                  283  bool try_lock() {return true; }
                  +
                  284  void unlock() { }
                  +
                  285 };
                  +
                  286 
                  +
                  287 
                  +
                  288 #if STREAM_THREAD_SAFE
                  +
                  289 typedef std::mutex StreamMutex;
                  +
                  290 #else
                  +
                  291 #warning "Stream thread-safe disabled"
                  +
                  292 typedef FakeMutex StreamMutex;
                  +
                  293 #endif
                  +
                  294 
                  +
                  295 #if DEVICE_THREAD_SAFE
                  +
                  296 typedef std::mutex DeviceMutex;
                  +
                  297 #else
                  +
                  298 typedef FakeMutex DeviceMutex;
                  +
                  299 #warning "Device thread-safe disabled"
                  +
                  300 #endif
                  +
                  301 
                  +
                  302 //
                  +
                  303 //---
                  +
                  304 // Protects access to the member _data with a lock acquired on contruction/destruction.
                  +
                  305 // T must contain a _mutex field which meets the BasicLockable requirements (lock/unlock)
                  +
                  306 template<typename T>
                  + +
                  308 {
                  +
                  309 public:
                  +
                  310  LockedAccessor(T &criticalData, bool autoUnlock=true) :
                  +
                  311  _criticalData(&criticalData),
                  +
                  312  _autoUnlock(autoUnlock)
                  +
                  313 
                  +
                  314  {
                  +
                  315  _criticalData->_mutex.lock();
                  +
                  316  };
                  +
                  317 
                  +
                  318  ~LockedAccessor()
                  +
                  319  {
                  +
                  320  if (_autoUnlock) {
                  +
                  321  _criticalData->_mutex.unlock();
                  +
                  322  }
                  +
                  323  }
                  +
                  324 
                  +
                  325  void unlock()
                  +
                  326  {
                  +
                  327  _criticalData->_mutex.unlock();
                  +
                  328  }
                  +
                  329 
                  +
                  330  // Syntactic sugar so -> can be used to get the underlying type.
                  +
                  331  T *operator->() { return _criticalData; };
                  +
                  332 
                  +
                  333 private:
                  +
                  334  T *_criticalData;
                  +
                  335  bool _autoUnlock;
                  +
                  336 };
                  +
                  337 
                  +
                  338 
                  +
                  339 template <typename MUTEX_TYPE>
                  +
                  340 struct LockedBase {
                  +
                  341 
                  +
                  342  // Experts-only interface for explicit locking.
                  +
                  343  // Most uses should use the lock-accessor.
                  +
                  344  void lock() { _mutex.lock(); }
                  +
                  345  void unlock() { _mutex.unlock(); }
                  +
                  346 
                  +
                  347  MUTEX_TYPE _mutex;
                  +
                  348 };
                  +
                  349 
                  +
                  350 
                  +
                  351 template <typename MUTEX_TYPE>
                  +
                  352 class ihipStreamCriticalBase_t : public LockedBase<MUTEX_TYPE>
                  +
                  353 {
                  +
                  354 public:
                  + +
                  356  _last_command_type(ihipCommandCopyH2H),
                  +
                  357  _last_copy_signal(NULL),
                  +
                  358  _signalCursor(0),
                  +
                  359  _oldest_live_sig_id(1),
                  +
                  360  _stream_sig_id(0)
                  +
                  361  {
                  +
                  362  _signalPool.resize(HIP_STREAM_SIGNALS > 0 ? HIP_STREAM_SIGNALS : 1);
                  +
                  363  };
                  +
                  364 
                  + +
                  366  _signalPool.clear();
                  +
                  367  }
                  +
                  368 
                  + +
                  370 
                  +
                  371 
                  +
                  372 public:
                  +
                  373  // Critical Data:
                  +
                  374  ihipCommand_t _last_command_type; // type of the last command
                  +
                  375 
                  +
                  376  // signal of last copy command sent to the stream.
                  +
                  377  // May be NULL, indicating the previous command has completley finished and future commands don't need to create a dependency.
                  +
                  378  // Copy can be either H2D or D2H.
                  +
                  379  ihipSignal_t *_last_copy_signal;
                  +
                  380 
                  +
                  381  hc::completion_future _last_kernel_future; // Completion future of last kernel command sent to GPU.
                  +
                  382 
                  +
                  383  // Signal pool:
                  +
                  384  int _signalCursor;
                  +
                  385  SIGSEQNUM _oldest_live_sig_id; // oldest live seq_id, anything < this can be allocated.
                  +
                  386  std::deque<ihipSignal_t> _signalPool; // Pool of signals for use by this stream.
                  +
                  387 
                  +
                  388 
                  +
                  389  SIGSEQNUM _stream_sig_id; // Monotonically increasing unique signal id.
                  +
                  390 };
                  +
                  391 
                  +
                  392 
                  + + +
                  395 
                  +
                  396 
                  +
                  397 
                  +
                  398 // Internal stream structure.
                  + +
                  400 public:
                  +
                  401 typedef uint64_t SeqNum_t ;
                  +
                  402 
                  +
                  403  ihipStream_t(unsigned device_index, hc::accelerator_view av, unsigned int flags);
                  +
                  404  ~ihipStream_t();
                  +
                  405 
                  +
                  406  // kind is hipMemcpyKind
                  +
                  407  void copySync (LockedAccessor_StreamCrit_t &crit, void* dst, const void* src, size_t sizeBytes, unsigned kind);
                  +
                  408  void locked_copySync (void* dst, const void* src, size_t sizeBytes, unsigned kind);
                  +
                  409 
                  +
                  410  void copyAsync(void* dst, const void* src, size_t sizeBytes, unsigned kind);
                  +
                  411 
                  +
                  412  //---
                  +
                  413  // Thread-safe accessors - these acquire / release mutex:
                  +
                  414  bool lockopen_preKernelCommand();
                  +
                  415  void lockclose_postKernelCommand(hc::completion_future &kernel_future);
                  +
                  416 
                  +
                  417  int preCopyCommand(LockedAccessor_StreamCrit_t &crit, ihipSignal_t *lastCopy, hsa_signal_t *waitSignal, ihipCommand_t copyType);
                  +
                  418 
                  +
                  419  void locked_reclaimSignals(SIGSEQNUM sigNum);
                  +
                  420  void locked_wait(bool assertQueueEmpty=false);
                  +
                  421  SIGSEQNUM locked_lastCopySeqId() {LockedAccessor_StreamCrit_t crit(_criticalData); return lastCopySeqId(crit); };
                  +
                  422 
                  +
                  423  // Use this if we already have the stream critical data mutex:
                  +
                  424  void wait(LockedAccessor_StreamCrit_t &crit, bool assertQueueEmpty=false);
                  +
                  425 
                  +
                  426 
                  +
                  427 
                  +
                  428  // Non-threadsafe accessors - must be protected by high-level stream lock with accessor passed to function.
                  +
                  429  SIGSEQNUM lastCopySeqId (LockedAccessor_StreamCrit_t &crit) { return crit->_last_copy_signal ? crit->_last_copy_signal->_sig_id : 0; };
                  +
                  430  ihipSignal_t * allocSignal (LockedAccessor_StreamCrit_t &crit);
                  +
                  431 
                  +
                  432 
                  +
                  433  //-- Non-racy accessors:
                  +
                  434  // These functions access fields set at initialization time and are non-racy (so do not acquire mutex)
                  +
                  435  ihipDevice_t * getDevice() const;
                  +
                  436 
                  +
                  437 
                  +
                  438 public:
                  +
                  439  //---
                  +
                  440  //Public member vars - these are set at initialization and never change:
                  +
                  441  SeqNum_t _id; // monotonic sequence ID
                  +
                  442  hc::accelerator_view _av;
                  +
                  443  unsigned _flags;
                  +
                  444 
                  +
                  445 private: // Critical Data. THis MUST be accessed through LockedAccessor_StreamCrit_t
                  +
                  446  ihipStreamCritical_t _criticalData;
                  +
                  447 
                  +
                  448 private:
                  +
                  449  void enqueueBarrier(hsa_queue_t* queue, ihipSignal_t *depSignal);
                  +
                  450  void waitCopy(LockedAccessor_StreamCrit_t &crit, ihipSignal_t *signal);
                  +
                  451 
                  +
                  452  // The unsigned return is hipMemcpyKind
                  +
                  453  unsigned resolveMemcpyDirection(bool srcInDeviceMem, bool dstInDeviceMem);
                  +
                  454  void setCopyAgents(unsigned kind, ihipCommand_t *commandType, hsa_agent_t *srcAgent, hsa_agent_t *dstAgent);
                  +
                  455 
                  +
                  456  unsigned _device_index; // index into the g_device array
                  +
                  457 
                  +
                  458  friend std::ostream& operator<<(std::ostream& os, const ihipStream_t& s);
                  +
                  459 };
                  +
                  460 
                  +
                  461 
                  +
                  462 inline std::ostream& operator<<(std::ostream& os, const ihipStream_t& s)
                  +
                  463 {
                  +
                  464  os << "stream#";
                  +
                  465  os << s._device_index;
                  +
                  466  os << '.';
                  +
                  467  os << s._id;
                  +
                  468  return os;
                  +
                  469 }
                  +
                  470 
                  +
                  471 
                  +
                  472 //----
                  +
                  473 // Internal event structure:
                  +
                  474 enum hipEventStatus_t {
                  +
                  475  hipEventStatusUnitialized = 0, // event is unutilized, must be "Created" before use.
                  +
                  476  hipEventStatusCreated = 1,
                  +
                  477  hipEventStatusRecording = 2, // event has been enqueued to record something.
                  +
                  478  hipEventStatusRecorded = 3, // event has been recorded - timestamps are valid.
                  +
                  479 } ;
                  +
                  480 
                  +
                  481 
                  +
                  482 // internal hip event structure.
                  +
                  483 struct ihipEvent_t {
                  +
                  484  hipEventStatus_t _state;
                  +
                  485 
                  +
                  486  hipStream_t _stream; // Stream where the event is recorded, or NULL if all streams.
                  +
                  487  unsigned _flags;
                  +
                  488 
                  +
                  489  hc::completion_future _marker;
                  +
                  490  uint64_t _timestamp; // store timestamp, may be set on host or by marker.
                  +
                  491 
                  +
                  492  SIGSEQNUM _copy_seq_id;
                  +
                  493 } ;
                  +
                  494 
                  +
                  495 
                  +
                  496 
                  +
                  497 
                  +
                  498 
                  +
                  499 //---
                  +
                  500 // Data that must be protected with thread-safe access
                  +
                  501 // All members are private - this class must be accessed through friend LockedAccessor which
                  +
                  502 // will lock the mutex on construction and unlock on destruction.
                  +
                  503 //
                  +
                  504 // MUTEX_TYPE is template argument so can easily convert to FakeMutex for performance or stress testing.
                  +
                  505 template <class MUTEX_TYPE>
                  + +
                  507 {
                  +
                  508 public:
                  +
                  509  ihipDeviceCriticalBase_t() : _stream_id(0), _peerAgents(nullptr) {};
                  +
                  510 
                  +
                  511  void init(unsigned deviceCnt) {
                  +
                  512  assert(_peerAgents == nullptr);
                  +
                  513  _peerAgents = new hsa_agent_t[deviceCnt];
                  +
                  514  };
                  +
                  515 
                  + +
                  517  if (_peerAgents != nullptr) {
                  +
                  518  delete _peerAgents;
                  +
                  519  _peerAgents = nullptr;
                  +
                  520  }
                  +
                  521  }
                  +
                  522  friend class LockedAccessor<ihipDeviceCriticalBase_t>;
                  +
                  523 
                  +
                  524  std::list<ihipStream_t*> &streams() { return _streams; };
                  +
                  525  const std::list<ihipStream_t*> &const_streams() const { return _streams; };
                  +
                  526 
                  +
                  527  // "Allocate" a stream ID:
                  +
                  528  ihipStream_t::SeqNum_t incStreamId() { return _stream_id++; };
                  +
                  529 
                  +
                  530  bool addPeer(ihipDevice_t *peer);
                  +
                  531  bool removePeer(ihipDevice_t *peer);
                  +
                  532  void resetPeers(ihipDevice_t *thisDevice);
                  +
                  533 
                  +
                  534  uint32_t peerCnt() const { return _peerCnt; };
                  +
                  535  hsa_agent_t *peerAgents() const { return _peerAgents; };
                  +
                  536 
                  +
                  537 
                  +
                  538 private:
                  +
                  539  std::list<ihipStream_t*> _streams; // streams associated with this device.
                  +
                  540  ihipStream_t::SeqNum_t _stream_id;
                  +
                  541 
                  +
                  542  // These reflect the currently Enabled set of peers for this GPU:
                  +
                  543  std::list<ihipDevice_t*> _peers; // list of enabled peer devices.
                  +
                  544  uint32_t _peerCnt; // number of enabled peers
                  +
                  545  hsa_agent_t *_peerAgents; // efficient packed array of enabled agents (to use for allocations.)
                  +
                  546 private:
                  +
                  547  void recomputePeerAgents();
                  +
                  548 };
                  +
                  549 
                  +
                  550 // Note Mutex selected based on DeviceMutex
                  + +
                  552 
                  +
                  553 // This type is used by functions that need access to the critical device structures.
                  + +
                  555 
                  +
                  556 
                  +
                  557 
                  +
                  558 //-------------------------------------------------------------------------------------------------
                  +
                  559 // Functions which read or write the critical data are named locked_.
                  +
                  560 // ihipDevice_t does not use recursive locks so the ihip implementation must avoid calling a locked_ function from within a locked_ function.
                  +
                  561 // External functions which call several locked_ functions will acquire and release the lock for each function. if this occurs in
                  +
                  562 // performance-sensitive code we may want to refactor by adding non-locked functions and creating a new locked_ member function to call them all.
                  + +
                  564 {
                  +
                  565 public: // Functions:
                  +
                  566  ihipDevice_t() {}; // note: calls constructor for _criticalData
                  +
                  567  void init(unsigned device_index, unsigned deviceCnt, hc::accelerator &acc, unsigned flags);
                  +
                  568  ~ihipDevice_t();
                  +
                  569 
                  +
                  570  void locked_addStream(ihipStream_t *s);
                  +
                  571  void locked_removeStream(ihipStream_t *s);
                  +
                  572  void locked_reset();
                  +
                  573  void locked_waitAllStreams();
                  +
                  574  void locked_syncDefaultStream(bool waitOnSelf);
                  +
                  575 
                  +
                  576  ihipDeviceCritical_t &criticalData() { return _criticalData; }; // TODO, move private. Fix P2P.
                  +
                  577 
                  +
                  578 public: // Data, set at initialization:
                  +
                  579  unsigned _device_index; // index into g_devices.
                  +
                  580 
                  +
                  581  hipDeviceProp_t _props; // saved device properties.
                  +
                  582  hc::accelerator _acc;
                  +
                  583  hsa_agent_t _hsa_agent; // hsa agent handle
                  +
                  584 
                  +
                  585  // The NULL stream is used if no other stream is specified.
                  +
                  586  // NULL has special synchronization properties with other streams.
                  +
                  587  ihipStream_t *_default_stream;
                  +
                  588 
                  +
                  589 
                  +
                  590  unsigned _compute_units;
                  +
                  591 
                  +
                  592  StagingBuffer *_staging_buffer[2]; // one buffer for each direction.
                  +
                  593 
                  +
                  594 
                  +
                  595  unsigned _device_flags;
                  +
                  596 
                  +
                  597 private:
                  +
                  598  hipError_t getProperties(hipDeviceProp_t* prop);
                  +
                  599 
                  +
                  600 private: // Critical data, protected with locked access:
                  +
                  601  // Members of _protected data MUST be accessed through the LockedAccessor.
                  +
                  602  // Search for LockedAccessor<ihipDeviceCritical_t> for examples; do not access _criticalData directly.
                  +
                  603  ihipDeviceCritical_t _criticalData;
                  +
                  604 
                  +
                  605 };
                  +
                  606 
                  +
                  607 
                  +
                  608 
                  +
                  609 // Global variable definition:
                  +
                  610 extern std::once_flag hip_initialized;
                  +
                  611 extern ihipDevice_t *g_devices; // Array of all non-emulated (ie GPU) accelerators in the system.
                  +
                  612 extern bool g_visible_device; // Set the flag when HIP_VISIBLE_DEVICES is set
                  +
                  613 extern unsigned g_deviceCnt;
                  +
                  614 extern std::vector<int> g_hip_visible_devices; /* vector of integers that contains the visible device IDs */
                  +
                  615 extern hsa_agent_t g_cpu_agent ; // the CPU agent.
                  +
                  616 //=================================================================================================
                  +
                  617 void ihipInit();
                  +
                  618 const char *ihipErrorString(hipError_t);
                  +
                  619 ihipDevice_t *ihipGetTlsDefaultDevice();
                  +
                  620 ihipDevice_t *ihipGetDevice(int);
                  +
                  621 void ihipSetTs(hipEvent_t e);
                  +
                  622 
                  +
                  623 template<typename T>
                  +
                  624 hc::completion_future ihipMemcpyKernel(hipStream_t, T*, const T*, size_t);
                  +
                  625 
                  +
                  626 template<typename T>
                  +
                  627 hc::completion_future ihipMemsetKernel(hipStream_t, T*, T, size_t);
                  +
                  628 
                  +
                  629 hipStream_t ihipSyncAndResolveStream(hipStream_t);
                  +
                  630 template <typename T>
                  +
                  631 
                  +
                  632 hc::completion_future
                  +
                  633 ihipMemsetKernel(hipStream_t stream, T * ptr, T val, size_t sizeBytes)
                  +
                  634 {
                  +
                  635  int wg = std::min((unsigned)8, stream->getDevice()->_compute_units);
                  +
                  636  const int threads_per_wg = 256;
                  +
                  637 
                  +
                  638  int threads = wg * threads_per_wg;
                  +
                  639  if (threads > sizeBytes) {
                  +
                  640  threads = ((sizeBytes + threads_per_wg - 1) / threads_per_wg) * threads_per_wg;
                  +
                  641  }
                  +
                  642 
                  +
                  643 
                  +
                  644  hc::extent<1> ext(threads);
                  +
                  645  auto ext_tile = ext.tile(threads_per_wg);
                  +
                  646 
                  +
                  647  hc::completion_future cf =
                  +
                  648  hc::parallel_for_each(
                  +
                  649  stream->_av,
                  +
                  650  ext_tile,
                  +
                  651  [=] (hc::tiled_index<1> idx)
                  +
                  652  __attribute__((hc))
                  +
                  653  {
                  +
                  654  int offset = amp_get_global_id(0);
                  +
                  655  // TODO-HCC - change to hc_get_local_size()
                  +
                  656  int stride = amp_get_local_size(0) * hc_get_num_groups(0) ;
                  +
                  657 
                  +
                  658  for (int i=offset; i<sizeBytes; i+=stride) {
                  +
                  659  ptr[i] = val;
                  +
                  660  }
                  +
                  661  });
                  +
                  662 
                  +
                  663  return cf;
                  +
                  664 }
                  +
                  665 
                  +
                  666 template <typename T>
                  +
                  667 hc::completion_future
                  +
                  668 ihipMemcpyKernel(hipStream_t stream, T * c, const T * a, size_t sizeBytes)
                  +
                  669 {
                  +
                  670  int wg = std::min((unsigned)8, stream->getDevice()->_compute_units);
                  +
                  671  const int threads_per_wg = 256;
                  +
                  672 
                  +
                  673  int threads = wg * threads_per_wg;
                  +
                  674  if (threads > sizeBytes) {
                  +
                  675  threads = ((sizeBytes + threads_per_wg - 1) / threads_per_wg) * threads_per_wg;
                  +
                  676  }
                  +
                  677 
                  +
                  678 
                  +
                  679  hc::extent<1> ext(threads);
                  +
                  680  auto ext_tile = ext.tile(threads_per_wg);
                  +
                  681 
                  +
                  682  hc::completion_future cf =
                  +
                  683  hc::parallel_for_each(
                  +
                  684  stream->_av,
                  +
                  685  ext_tile,
                  +
                  686  [=] (hc::tiled_index<1> idx)
                  +
                  687  __attribute__((hc))
                  +
                  688  {
                  +
                  689  int offset = amp_get_global_id(0);
                  +
                  690  // TODO-HCC - change to hc_get_local_size()
                  +
                  691  int stride = amp_get_local_size(0) * hc_get_num_groups(0) ;
                  +
                  692 
                  +
                  693  for (int i=offset; i<sizeBytes; i+=stride) {
                  +
                  694  c[i] = a[i];
                  +
                  695  }
                  +
                  696  });
                  +
                  697 
                  +
                  698  return cf;
                  +
                  699 }
                  +
                  700 
                  +
                  701 #endif
                  +
                  Definition: hip_hcc.h:563
                  +
                  Definition: hip_hcc.h:340
                  +
                  Definition: hip_hcc.h:279
                  +
                  hipError_t
                  Definition: hip_runtime_api.h:142
                  +
                  Definition: hip_runtime_api.h:47
                  +
                  Definition: hip_hcc.h:506
                  +
                  Definition: hip_hcc.h:266
                  +
                  Definition: hip_runtime_api.h:74
                  +
                  Definition: staging_buffer.h:40
                  +
                  Definition: hip_hcc.h:483
                  +
                  Definition: hip_hcc.h:220
                  +
                  Definition: hip_hcc.h:399
                  +
                  Definition: hip_hcc.h:352
                  +
                  Definition: hip_hcc.h:307
                  +
                  + + + + diff --git a/docs/RuntimeAPI/html/hip__runtime_8h_source.html b/docs/RuntimeAPI/html/hip__runtime_8h_source.html index d01ac13ca9..1fff5853a6 100644 --- a/docs/RuntimeAPI/html/hip__runtime_8h_source.html +++ b/docs/RuntimeAPI/html/hip__runtime_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hip_runtime.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hip_runtime.h Source File @@ -131,9 +131,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  50 
                  51 #include <hip_common.h>
                  52 
                  -
                  53 #if defined(__HIP_PLATFORM_HCC__) and not defined (__HIP_PLATFORM_NVCC__)
                  +
                  53 #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__)
                  54 #include <hcc_detail/hip_runtime.h>
                  -
                  55 #elif defined(__HIP_PLATFORM_NVCC__) and not defined (__HIP_PLATFORM_HCC__)
                  +
                  55 #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__)
                  56 #include <nvcc_detail/hip_runtime.h>
                  57 #else
                  58 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__");
                  @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hip__runtime__api_8h_source.html b/docs/RuntimeAPI/html/hip__runtime__api_8h_source.html index 885302e6f0..0e70e6336e 100644 --- a/docs/RuntimeAPI/html/hip__runtime__api_8h_source.html +++ b/docs/RuntimeAPI/html/hip__runtime__api_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hip_runtime_api.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hip_runtime_api.h Source File @@ -205,7 +205,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  138  * @enum
                  139  * @ingroup Enumerations
                  140  */
                  -
                  141 // Developer note - when updating these, update the hipErrorName and hipErrorString functions
                  +
                  141 // Developer note - when updating these, update the hipErrorName and hipErrorString functions in NVCC and HCC paths
                  142 typedef enum hipError_t {
                  @@ -222,131 +222,135 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - - - -
                  161 } hipError_t;
                  -
                  162 
                  -
                  163 /*
                  -
                  164  * @brief hipDeviceAttribute_t
                  -
                  165  * @enum
                  -
                  166  * @ingroup Enumerations
                  -
                  167  */
                  -
                  168 typedef enum hipDeviceAttribute_t {
                  - - - - - - - - - - - - - - - - - - - - - - - - - - -
                  195 
                  -
                  200 #if defined(__HIP_PLATFORM_HCC__) and not defined (__HIP_PLATFORM_NVCC__)
                  - -
                  202 #elif defined(__HIP_PLATFORM_NVCC__) and not defined (__HIP_PLATFORM_HCC__)
                  -
                  203 #include "nvcc_detail/hip_runtime_api.h"
                  -
                  204 #else
                  -
                  205 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__");
                  -
                  206 #endif
                  -
                  207 
                  -
                  208 
                  -
                  216 #ifdef __cplusplus
                  -
                  217 template<class T>
                  -
                  218 static inline hipError_t hipMalloc ( T** devPtr, size_t size)
                  -
                  219 {
                  -
                  220  return hipMalloc((void**)devPtr, size);
                  -
                  221 }
                  -
                  222 
                  -
                  223 // Provide an override to automatically typecast the pointer type from void**, and also provide a default for the flags.
                  -
                  224 template<class T>
                  -
                  225 static inline hipError_t hipHostMalloc( T** ptr, size_t size, unsigned int flags = hipHostMallocDefault)
                  -
                  226 {
                  -
                  227  return hipHostMalloc((void**)ptr, size, flags);
                  -
                  228 }
                  -
                  229 #endif
                  + + + + + +
                  163 } hipError_t;
                  +
                  164 
                  +
                  165 /*
                  +
                  166  * @brief hipDeviceAttribute_t
                  +
                  167  * @enum
                  +
                  168  * @ingroup Enumerations
                  +
                  169  */
                  +
                  170 typedef enum hipDeviceAttribute_t {
                  + + + + + + + + + + + + + + + + + + + + + + + + + + +
                  197 
                  +
                  202 #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__)
                  + +
                  204 #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__)
                  +
                  205 #include "nvcc_detail/hip_runtime_api.h"
                  +
                  206 #else
                  +
                  207 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__");
                  +
                  208 #endif
                  +
                  209 
                  +
                  210 
                  +
                  218 #ifdef __cplusplus
                  +
                  219 template<class T>
                  +
                  220 static inline hipError_t hipMalloc ( T** devPtr, size_t size)
                  +
                  221 {
                  +
                  222  return hipMalloc((void**)devPtr, size);
                  +
                  223 }
                  +
                  224 
                  +
                  225 // Provide an override to automatically typecast the pointer type from void**, and also provide a default for the flags.
                  +
                  226 template<class T>
                  +
                  227 static inline hipError_t hipHostMalloc( T** ptr, size_t size, unsigned int flags = hipHostMallocDefault)
                  +
                  228 {
                  +
                  229  return hipHostMalloc((void**)ptr, size, flags);
                  +
                  230 }
                  +
                  231 #endif
                  Call to hipGetDeviceCount returned 0 devices.
                  Definition: hip_runtime_api.h:155
                  size_t totalConstMem
                  Size of shared memory region (in bytes).
                  Definition: hip_runtime_api.h:86
                  -
                  Maximum Shared Memory Per Multiprocessor.
                  Definition: hip_runtime_api.h:192
                  -
                  Maximum x-dimension of a block.
                  Definition: hip_runtime_api.h:170
                  -
                  Maximum x-dimension of a grid.
                  Definition: hip_runtime_api.h:173
                  +
                  Maximum Shared Memory Per Multiprocessor.
                  Definition: hip_runtime_api.h:194
                  +
                  Maximum x-dimension of a block.
                  Definition: hip_runtime_api.h:172
                  +
                  Maximum x-dimension of a grid.
                  Definition: hip_runtime_api.h:175
                  +
                  Peer access was already enabled from the current device.
                  Definition: hip_runtime_api.h:159
                  Unknown symbol.
                  Definition: hip_runtime_api.h:146
                  -
                  HSA runtime memory call returned error. Typically not seen in production systems. ...
                  Definition: hip_runtime_api.h:158
                  -
                  Global memory bus width in bits.
                  Definition: hip_runtime_api.h:182
                  +
                  HSA runtime memory call returned error. Typically not seen in production systems. ...
                  Definition: hip_runtime_api.h:160
                  +
                  Global memory bus width in bits.
                  Definition: hip_runtime_api.h:184
                  Successful completion.
                  Definition: hip_runtime_api.h:143
                  int minor
                  Minor compute capability. On HCC, this is an approximation and features may differ from CUDA CC...
                  Definition: hip_runtime_api.h:88
                  int canMapHostMemory
                  Check whether HIP can map host memory.
                  Definition: hip_runtime_api.h:100
                  -
                  Maximum number of 32-bit registers available to a thread block. This number is shared by all thread b...
                  Definition: hip_runtime_api.h:179
                  +
                  Maximum number of 32-bit registers available to a thread block. This number is shared by all thread b...
                  Definition: hip_runtime_api.h:181
                  int regsPerBlock
                  Registers per block.
                  Definition: hip_runtime_api.h:78
                  -
                  Size of L2 cache in bytes. 0 if the device doesn't have L2 cache.
                  Definition: hip_runtime_api.h:185
                  -
                  #define hipHostMallocDefault
                  Flags that can be used with hipHostMalloc.
                  Definition: hip_runtime_api.h:60
                  -
                  HSA runtime call other than memory returned error. Typically not seen in production systems...
                  Definition: hip_runtime_api.h:159
                  +
                  Size of L2 cache in bytes. 0 if the device doesn't have L2 cache.
                  Definition: hip_runtime_api.h:187
                  +
                  #define hipHostMallocDefault
                  Flags that can be used with hipHostMalloc.
                  Definition: hip_runtime_api.h:69
                  +
                  HSA runtime call other than memory returned error. Typically not seen in production systems...
                  Definition: hip_runtime_api.h:161
                  int isMultiGpuBoard
                  1 if device is on a multi-GPU board, 0 if not.
                  Definition: hip_runtime_api.h:99
                  DeviceID must be in range 0...#compute-devices.
                  Definition: hip_runtime_api.h:150
                  -
                  Peak clock frequency in kilohertz.
                  Definition: hip_runtime_api.h:180
                  +
                  Peak clock frequency in kilohertz.
                  Definition: hip_runtime_api.h:182
                  Definition: hip_runtime_api.h:117
                  int clockRate
                  Max clock frequency of the multiProcessors in khz.
                  Definition: hip_runtime_api.h:83
                  -
                  Maximum z-dimension of a grid.
                  Definition: hip_runtime_api.h:175
                  +
                  Maximum z-dimension of a grid.
                  Definition: hip_runtime_api.h:177
                  Out of resources error.
                  Definition: hip_runtime_api.h:147
                  -
                  Minor compute capability version number.
                  Definition: hip_runtime_api.h:188
                  -
                  Maximum shared memory available per block in bytes.
                  Definition: hip_runtime_api.h:176
                  +
                  Minor compute capability version number.
                  Definition: hip_runtime_api.h:190
                  +
                  Maximum shared memory available per block in bytes.
                  Definition: hip_runtime_api.h:178
                  int pciBusID
                  PCI Bus ID.
                  Definition: hip_runtime_api.h:96
                  -
                  Maximum y-dimension of a grid.
                  Definition: hip_runtime_api.h:174
                  -
                  Multiple GPU devices.
                  Definition: hip_runtime_api.h:193
                  +
                  Maximum y-dimension of a grid.
                  Definition: hip_runtime_api.h:176
                  +
                  Multiple GPU devices.
                  Definition: hip_runtime_api.h:195
                  Unknown error.
                  Definition: hip_runtime_api.h:157
                  int maxThreadsPerBlock
                  Max work items per work group or workgroup max size.
                  Definition: hip_runtime_api.h:80
                  -
                  Maximum y-dimension of a block.
                  Definition: hip_runtime_api.h:171
                  -
                  hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
                  Allocate device accessible page locked host memory.
                  Definition: hip_hcc.cpp:2214
                  +
                  Maximum y-dimension of a block.
                  Definition: hip_runtime_api.h:173
                  +
                  hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
                  Allocate device accessible page locked host memory.
                  Definition: hip_memory.cpp:152
                  size_t sharedMemPerBlock
                  Size of shared memory region (in bytes).
                  Definition: hip_runtime_api.h:77
                  int maxThreadsPerMultiProcessor
                  Maximum resident threads per multi-processor.
                  Definition: hip_runtime_api.h:91
                  int l2CacheSize
                  L2 cache size.
                  Definition: hip_runtime_api.h:90
                  -
                  hipDeviceAttribute_t
                  Definition: hip_runtime_api.h:168
                  -
                  Major compute capability version number.
                  Definition: hip_runtime_api.h:187
                  -
                  Maximum number of threads per block.
                  Definition: hip_runtime_api.h:169
                  +
                  hipDeviceAttribute_t
                  Definition: hip_runtime_api.h:170
                  +
                  Major compute capability version number.
                  Definition: hip_runtime_api.h:189
                  +
                  Peer access was never enabled from the current device.
                  Definition: hip_runtime_api.h:158
                  +
                  Maximum number of threads per block.
                  Definition: hip_runtime_api.h:171
                  Resource handle (hipEvent_t or hipStream_t) invalid.
                  Definition: hip_runtime_api.h:149
                  Memory allocation error.
                  Definition: hip_runtime_api.h:144
                  hipDeviceArch_t arch
                  Architectural feature flags. New for HIP.
                  Definition: hip_runtime_api.h:94
                  int maxGridSize[3]
                  Max grid dimensions (XYZ).
                  Definition: hip_runtime_api.h:82
                  int computeMode
                  Compute mode.
                  Definition: hip_runtime_api.h:92
                  -
                  Maximum z-dimension of a block.
                  Definition: hip_runtime_api.h:172
                  -
                  PCI Bus ID.
                  Definition: hip_runtime_api.h:190
                  +
                  Maximum z-dimension of a block.
                  Definition: hip_runtime_api.h:174
                  +
                  PCI Bus ID.
                  Definition: hip_runtime_api.h:192
                  Invalid memory copy direction.
                  Definition: hip_runtime_api.h:151
                  -
                  Marker that more error codes are needed.
                  Definition: hip_runtime_api.h:160
                  -
                  Warp size in threads.
                  Definition: hip_runtime_api.h:178
                  +
                  Marker that more error codes are needed.
                  Definition: hip_runtime_api.h:162
                  +
                  Warp size in threads.
                  Definition: hip_runtime_api.h:180
                  int major
                  Major compute capability. On HCC, this is an approximation and features may differ from CUDA CC...
                  Definition: hip_runtime_api.h:87
                  -
                  Peak memory clock frequency in kilohertz.
                  Definition: hip_runtime_api.h:181
                  -
                  Maximum resident threads per multiprocessor.
                  Definition: hip_runtime_api.h:186
                  +
                  Peak memory clock frequency in kilohertz.
                  Definition: hip_runtime_api.h:183
                  +
                  Maximum resident threads per multiprocessor.
                  Definition: hip_runtime_api.h:188
                  hipError_t
                  Definition: hip_runtime_api.h:142
                  int clockInstructionRate
                  Frequency in khz of the timer used by the device-side "clock*" instructions. New for HIP...
                  Definition: hip_runtime_api.h:93
                  -
                  Constant memory size in bytes.
                  Definition: hip_runtime_api.h:177
                  +
                  Constant memory size in bytes.
                  Definition: hip_runtime_api.h:179
                  Memory free error.
                  Definition: hip_runtime_api.h:145
                  int warpSize
                  Warp size.
                  Definition: hip_runtime_api.h:79
                  int concurrentKernels
                  Device can possibly execute multiple kernels concurrently.
                  Definition: hip_runtime_api.h:95
                  size_t totalGlobalMem
                  Size of global memory region (in bytes).
                  Definition: hip_runtime_api.h:76
                  Invalid Device Pointer.
                  Definition: hip_runtime_api.h:152
                  -
                  hipError_t hipMalloc(void **ptr, size_t size)
                  Allocate memory on the default accelerator.
                  Definition: hip_hcc.cpp:2165
                  -
                  Compute mode that device is currently in.
                  Definition: hip_runtime_api.h:184
                  -
                  PCI Device ID.
                  Definition: hip_runtime_api.h:191
                  +
                  hipError_t hipMalloc(void **ptr, size_t size)
                  Allocate memory on the default accelerator.
                  Definition: hip_memory.cpp:117
                  +
                  Compute mode that device is currently in.
                  Definition: hip_runtime_api.h:186
                  +
                  PCI Device ID.
                  Definition: hip_runtime_api.h:193
                  int maxThreadsDim[3]
                  Max number of threads in each dimension (XYZ) of a block.
                  Definition: hip_runtime_api.h:81
                  -
                  Number of multiprocessors on the device.
                  Definition: hip_runtime_api.h:183
                  +
                  Number of multiprocessors on the device.
                  Definition: hip_runtime_api.h:185
                  int memoryBusWidth
                  Global memory bus width in bits.
                  Definition: hip_runtime_api.h:85
                  One or more of the parameters passed to the API call is NULL or not in an acceptable range...
                  Definition: hip_runtime_api.h:148
                  Definition: hip_runtime_api.h:74
                  @@ -358,12 +362,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
                  int memoryClockRate
                  Max global memory clock frequency in khz.
                  Definition: hip_runtime_api.h:84
                  TODO comment from hipErrorInitializationError.
                  Definition: hip_runtime_api.h:153
                  -
                  Device can possibly execute multiple kernels concurrently.
                  Definition: hip_runtime_api.h:189
                  +
                  Device can possibly execute multiple kernels concurrently.
                  Definition: hip_runtime_api.h:191
                  int multiProcessorCount
                  Number of multi-processors (compute units).
                  Definition: hip_runtime_api.h:89
                  diff --git a/docs/RuntimeAPI/html/hip__texture_8h.html b/docs/RuntimeAPI/html/hip__texture_8h.html index ed20a765ae..1e7af77260 100644 --- a/docs/RuntimeAPI/html/hip__texture_8h.html +++ b/docs/RuntimeAPI/html/hip__texture_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/hip_texture.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_texture.h File Reference @@ -109,8 +109,6 @@ Classes
                   
                  struct  textureReference
                   
                  struct  texture< T, texType, hipTextureReadMode >
                   
                  @@ -150,15 +148,15 @@ template<class T > - + - + - +

                  Macros

                   
                  template<class T , int dim, enum hipTextureReadMode readMode>
                  hipError_t hipBindTexture (size_t *offset, struct texture< T, dim, readMode > &tex, const void *devPtr, const struct hipChannelFormatDesc *desc, size_t size=UINT_MAX)
                  hipError_t hipBindTexture (size_t *offset, struct texture< T, dim, readMode > &tex, const void *devPtr, const struct hipChannelFormatDesc *desc, size_t size=UINT_MAX)
                   
                  template<class T , int dim, enum hipTextureReadMode readMode>
                  hipError_t hipBindTexture (size_t *offset, struct texture< T, dim, readMode > &tex, const void *devPtr, size_t size=UINT_MAX)
                  hipError_t hipBindTexture (size_t *offset, struct texture< T, dim, readMode > &tex, const void *devPtr, size_t size=UINT_MAX)
                   
                  template<class T , int dim, enum hipTextureReadMode readMode>
                  hipError_t hipUnbindTexture (struct texture< T, dim, readMode > *tex)
                  hipError_t hipUnbindTexture (struct texture< T, dim, readMode > *tex)
                   

                  Detailed Description

                  @@ -201,7 +199,7 @@ template<class T , int dim, enum hipTextureReadMode readMode>
                  diff --git a/docs/RuntimeAPI/html/hip__texture_8h_source.html b/docs/RuntimeAPI/html/hip__texture_8h_source.html index b115611916..87da06ba10 100644 --- a/docs/RuntimeAPI/html/hip__texture_8h_source.html +++ b/docs/RuntimeAPI/html/hip__texture_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/hip_texture.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_texture.h Source File @@ -110,158 +110,163 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
                  20 THE SOFTWARE.
                  21 */
                  -
                  22 #pragma once
                  -
                  23 
                  -
                  28 #include <limits.h>
                  -
                  29 
                  -
                  30 #include <hip_runtime.h>
                  -
                  31 
                  -
                  32 //----
                  -
                  33 //Texture - TODO - likely need to move this to a separate file only included with kernel compilation.
                  -
                  34 #define hipTextureType1D 1
                  -
                  35 
                  -
                  36 typedef struct hipChannelFormatDesc {
                  -
                  37  // TODO - this has 4-5 well-defined fields, we could just copy...
                  -
                  38  int _dummy;
                  - -
                  40 
                  -
                  41 typedef enum hipTextureReadMode
                  -
                  42 {
                  - - -
                  46 
                  - -
                  48 {
                  - - -
                  52 
                  - -
                  54  hipTextureFilterMode filterMode;
                  -
                  55  bool normalized;
                  -
                  56  hipChannelFormatDesc channelDesc;
                  -
                  57 };
                  -
                  58 
                  -
                  59 template <class T, int texType=hipTextureType1D, enum hipTextureReadMode=hipReadModeElementType>
                  -
                  60 struct texture : public textureReference {
                  -
                  61 
                  -
                  62  const T * _dataPtr; // pointer to underlying data.
                  -
                  63 
                  -
                  64  //texture() : filterMode(hipFilterModePoint), normalized(false), _dataPtr(NULL) {};
                  -
                  65 };
                  +
                  22 
                  +
                  23 //#pragma once
                  +
                  24 
                  +
                  25 #ifndef HIP_TEXTURE_H
                  +
                  26 #define HIP_TEXTURE_H
                  +
                  27 
                  +
                  33 #include <limits.h>
                  +
                  34 
                  +
                  35 #include <hip_runtime.h>
                  +
                  36 
                  +
                  37 //----
                  +
                  38 //Texture - TODO - likely need to move this to a separate file only included with kernel compilation.
                  +
                  39 #define hipTextureType1D 1
                  +
                  40 
                  +
                  41 typedef struct hipChannelFormatDesc {
                  +
                  42  // TODO - this has 4-5 well-defined fields, we could just copy...
                  +
                  43  int _dummy;
                  + +
                  45 
                  +
                  46 typedef enum hipTextureReadMode
                  +
                  47 {
                  + + +
                  51 
                  + +
                  53 {
                  + + +
                  57 
                  + +
                  59  hipTextureFilterMode filterMode;
                  +
                  60  bool normalized;
                  +
                  61  hipChannelFormatDesc channelDesc;
                  +
                  62 };
                  +
                  63 #if __cplusplus
                  +
                  64 template <class T, int texType=hipTextureType1D, enum hipTextureReadMode=hipReadModeElementType>
                  +
                  65 struct texture : public textureReference {
                  66 
                  -
                  67 
                  +
                  67  const T * _dataPtr; // pointer to underlying data.
                  68 
                  -
                  69 
                  -
                  70 #define tex1Dfetch(_tex, _addr) (_tex._dataPtr[_addr])
                  -
                  71 
                  -
                  72 
                  +
                  69  //texture() : filterMode(hipFilterModePoint), normalized(false), _dataPtr(NULL) {};
                  +
                  70 };
                  +
                  71 #endif
                  +
                  72 
                  73 
                  74 
                  -
                  82 // These are C++ APIs - maybe belong in separate file.
                  -
                  106 // C API:
                  -
                  107 #if 0
                  -
                  108 hipChannelFormatDesc hipBindTexture(size_t *offset, struct textureReference *tex, const void *devPtr, const struct hipChannelFormatDesc *desc, size_t size=UINT_MAX)
                  -
                  109 {
                  -
                  110  tex->_dataPtr = devPtr;
                  -
                  111 }
                  -
                  112 #endif
                  -
                  113 
                  -
                  114 /*
                  -
                  115  * @brief Returns a channel descriptor with format f and number of bits of each ocmponent x,y,z and w.
                  -
                  116  *
                  -
                  117  * @par Parameters
                  -
                  118  * None.
                  -
                  119  * @return Channel descriptor
                  -
                  120  *
                  +
                  75 #define tex1Dfetch(_tex, _addr) (_tex._dataPtr[_addr])
                  +
                  76 
                  +
                  77 
                  +
                  78 
                  +
                  79 
                  +
                  87 // These are C++ APIs - maybe belong in separate file.
                  +
                  111 // C API:
                  +
                  112 #if 0
                  +
                  113 hipChannelFormatDesc hipBindTexture(size_t *offset, struct textureReference *tex, const void *devPtr, const struct hipChannelFormatDesc *desc, size_t size=UINT_MAX)
                  +
                  114 {
                  +
                  115  tex->_dataPtr = devPtr;
                  +
                  116 }
                  +
                  117 #endif
                  +
                  118 
                  +
                  119 /*
                  +
                  120  * @brief Returns a channel descriptor with format f and number of bits of each ocmponent x,y,z and w.
                  121  *
                  -
                  122  **/
                  -
                  123 template <class T>
                  -
                  124 hipChannelFormatDesc hipCreateChannelDesc()
                  -
                  125 {
                  - -
                  127  return desc;
                  -
                  128 }
                  -
                  129 
                  -
                  130 /*
                  -
                  131  * @brief hipBindTexture Binds size bytes of the memory area pointed to by @p devPtr to the texture reference tex.
                  -
                  132  *
                  -
                  133  * @p desc describes how the memory is interpreted when fetching values from the texture. The @p offset parameter is an optional byte offset as with the low-level
                  -
                  134  * hipBindTexture() function. Any memory previously bound to tex is unbound.
                  -
                  135  *
                  -
                  136  * @param[in] offset - Offset in bytes
                  -
                  137  * @param[out] tex - texture to bind
                  -
                  138  * @param[in] devPtr - Memory area on device
                  -
                  139  * @param[in] desc - Channel format
                  -
                  140  * @param[in] size - Size of the memory area pointed to by devPtr
                  -
                  141  * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown
                  -
                  142  **/
                  -
                  143 template <class T, int dim, enum hipTextureReadMode readMode>
                  -
                  144 hipError_t hipBindTexture(size_t *offset,
                  -
                  145  struct texture<T, dim, readMode> &tex,
                  -
                  146  const void *devPtr,
                  -
                  147  const struct hipChannelFormatDesc *desc,
                  -
                  148  size_t size=UINT_MAX)
                  -
                  149 {
                  -
                  150  tex._dataPtr = static_cast<const T*>(devPtr);
                  -
                  151 
                  -
                  152  return hipSuccess;
                  -
                  153 }
                  -
                  154 
                  -
                  155 /*
                  -
                  156  * @brief hipBindTexture Binds size bytes of the memory area pointed to by @p devPtr to the texture reference tex.
                  -
                  157  *
                  -
                  158  * @p desc describes how the memory is interpreted when fetching values from the texture. The @p offset parameter is an optional byte offset as with the low-level
                  -
                  159  * hipBindTexture() function. Any memory previously bound to tex is unbound.
                  -
                  160  *
                  -
                  161  * @param[in] offset - Offset in bytes
                  -
                  162  * @param[in] tex - texture to bind
                  -
                  163  * @param[in] devPtr - Memory area on device
                  -
                  164  * @param[in] size - Size of the memory area pointed to by devPtr
                  -
                  165  * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown
                  -
                  166  **/
                  -
                  167 template <class T, int dim, enum hipTextureReadMode readMode>
                  -
                  168 hipError_t hipBindTexture(size_t *offset,
                  -
                  169  struct texture<T, dim, readMode> &tex,
                  -
                  170  const void *devPtr,
                  -
                  171  size_t size=UINT_MAX)
                  -
                  172 {
                  -
                  173  return hipBindTexture(offset, tex, devPtr, &tex.channelDesc, size);
                  -
                  174 }
                  -
                  175 
                  -
                  176 
                  -
                  177 /*
                  -
                  178  * @brief Unbinds the textuer bound to @p tex
                  -
                  179  *
                  -
                  180  * @param[in] tex - texture to unbind
                  -
                  181  *
                  -
                  182  * @return #hipSuccess
                  -
                  183  **/
                  -
                  184 template <class T, int dim, enum hipTextureReadMode readMode>
                  -
                  185 hipError_t hipUnbindTexture(struct texture<T, dim, readMode> *tex)
                  -
                  186 {
                  -
                  187  tex->_dataPtr = NULL;
                  -
                  188 
                  -
                  189  return hipSuccess;
                  -
                  190 }
                  -
                  191 
                  -
                  192 
                  +
                  122  * @par Parameters
                  +
                  123  * None.
                  +
                  124  * @return Channel descriptor
                  +
                  125  *
                  +
                  126  *
                  +
                  127  **/
                  +
                  128 template <class T>
                  +
                  129 hipChannelFormatDesc hipCreateChannelDesc()
                  +
                  130 {
                  + +
                  132  return desc;
                  +
                  133 }
                  +
                  134 
                  +
                  135 /*
                  +
                  136  * @brief hipBindTexture Binds size bytes of the memory area pointed to by @p devPtr to the texture reference tex.
                  +
                  137  *
                  +
                  138  * @p desc describes how the memory is interpreted when fetching values from the texture. The @p offset parameter is an optional byte offset as with the low-level
                  +
                  139  * hipBindTexture() function. Any memory previously bound to tex is unbound.
                  +
                  140  *
                  +
                  141  * @param[in] offset - Offset in bytes
                  +
                  142  * @param[out] tex - texture to bind
                  +
                  143  * @param[in] devPtr - Memory area on device
                  +
                  144  * @param[in] desc - Channel format
                  +
                  145  * @param[in] size - Size of the memory area pointed to by devPtr
                  +
                  146  * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown
                  +
                  147  **/
                  +
                  148 template <class T, int dim, enum hipTextureReadMode readMode>
                  +
                  149 hipError_t hipBindTexture(size_t *offset,
                  +
                  150  struct texture<T, dim, readMode> &tex,
                  +
                  151  const void *devPtr,
                  +
                  152  const struct hipChannelFormatDesc *desc,
                  +
                  153  size_t size=UINT_MAX)
                  +
                  154 {
                  +
                  155  tex._dataPtr = static_cast<const T*>(devPtr);
                  +
                  156 
                  +
                  157  return hipSuccess;
                  +
                  158 }
                  +
                  159 
                  +
                  160 /*
                  +
                  161  * @brief hipBindTexture Binds size bytes of the memory area pointed to by @p devPtr to the texture reference tex.
                  +
                  162  *
                  +
                  163  * @p desc describes how the memory is interpreted when fetching values from the texture. The @p offset parameter is an optional byte offset as with the low-level
                  +
                  164  * hipBindTexture() function. Any memory previously bound to tex is unbound.
                  +
                  165  *
                  +
                  166  * @param[in] offset - Offset in bytes
                  +
                  167  * @param[in] tex - texture to bind
                  +
                  168  * @param[in] devPtr - Memory area on device
                  +
                  169  * @param[in] size - Size of the memory area pointed to by devPtr
                  +
                  170  * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown
                  +
                  171  **/
                  +
                  172 template <class T, int dim, enum hipTextureReadMode readMode>
                  +
                  173 hipError_t hipBindTexture(size_t *offset,
                  +
                  174  struct texture<T, dim, readMode> &tex,
                  +
                  175  const void *devPtr,
                  +
                  176  size_t size=UINT_MAX)
                  +
                  177 {
                  +
                  178  return hipBindTexture(offset, tex, devPtr, &tex.channelDesc, size);
                  +
                  179 }
                  +
                  180 
                  +
                  181 
                  +
                  182 /*
                  +
                  183  * @brief Unbinds the textuer bound to @p tex
                  +
                  184  *
                  +
                  185  * @param[in] tex - texture to unbind
                  +
                  186  *
                  +
                  187  * @return #hipSuccess
                  +
                  188  **/
                  +
                  189 template <class T, int dim, enum hipTextureReadMode readMode>
                  +
                  190 hipError_t hipUnbindTexture(struct texture<T, dim, readMode> *tex)
                  +
                  191 {
                  +
                  192  tex->_dataPtr = NULL;
                  193 
                  -
                  194 // doxygen end Texture
                  -
                  200 // End doxygen API:
                  -
                  Definition: hip_texture.h:43
                  +
                  194  return hipSuccess;
                  +
                  195 }
                  +
                  196 
                  +
                  197 
                  +
                  198 
                  +
                  199 // doxygen end Texture
                  +
                  205 // End doxygen API:
                  +
                  210 #endif
                  +
                  211 
                  +
                  Definition: hip_texture.h:48
                  Successful completion.
                  Definition: hip_runtime_api.h:143
                  -
                  Definition: hip_texture.h:49
                  -
                  Definition: hip_texture.h:53
                  +
                  Definition: hip_texture.h:54
                  +
                  Definition: hip_texture.h:58
                  Contains definitions of APIs for HIP runtime.
                  hipError_t
                  Definition: hip_runtime_api.h:142
                  -
                  hipTextureReadMode
                  Definition: hip_texture.h:41
                  -
                  hipTextureFilterMode
                  Definition: hip_texture.h:47
                  -
                  Definition: hip_texture.h:36
                  -
                  Definition: hip_texture.h:60
                  +
                  hipTextureReadMode
                  Definition: hip_texture.h:46
                  +
                  hipTextureFilterMode
                  Definition: hip_texture.h:52
                  +
                  Definition: hip_texture.h:41
                  diff --git a/docs/RuntimeAPI/html/hip__util_8h_source.html b/docs/RuntimeAPI/html/hip__util_8h_source.html new file mode 100644 index 0000000000..e5e363a20a --- /dev/null +++ b/docs/RuntimeAPI/html/hip__util_8h_source.html @@ -0,0 +1,136 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_util.h Source File + + + + + + + + + +
                  +
                  + + + + + + +
                  +
                  HIP: Heterogenous-computing Interface for Portability +
                  +
                  +
                  + + + + + + + + + +
                  + +
                  + + +
                  +
                  +
                  +
                  hip_util.h
                  +
                  +
                  +
                  1 /*
                  +
                  2 Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
                  +
                  3 Permission is hereby granted, free of charge, to any person obtaining a copy
                  +
                  4 of this software and associated documentation files (the "Software"), to deal
                  +
                  5 in the Software without restriction, including without limitation the rights
                  +
                  6 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                  +
                  7 copies of the Software, and to permit persons to whom the Software is
                  +
                  8 furnished to do so, subject to the following conditions:
                  +
                  9 The above copyright notice and this permission notice shall be included in
                  +
                  10 all copies or substantial portions of the Software.
                  +
                  11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR
                  +
                  12 IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                  +
                  13 FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
                  +
                  14 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER
                  +
                  15 LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                  +
                  16 OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
                  +
                  17 THE SOFTWARE.
                  +
                  18 */
                  +
                  19 
                  +
                  20 
                  +
                  21 #ifndef HIP_UTIL_H
                  +
                  22 #define HIP_UTIL_H
                  +
                  23 
                  +
                  24 #include <assert.h>
                  +
                  25 #include <stdint.h>
                  +
                  26 #include <iostream>
                  +
                  27 #include <sstream>
                  +
                  28 #include <list>
                  +
                  29 #include <sys/types.h>
                  +
                  30 #include <unistd.h>
                  +
                  31 #include <deque>
                  +
                  32 #include <vector>
                  +
                  33 #include <algorithm>
                  +
                  34 
                  +
                  35 
                  +
                  36 #endif
                  +
                  + + + + diff --git a/docs/RuntimeAPI/html/hip__vector__types_8h_source.html b/docs/RuntimeAPI/html/hip__vector__types_8h_source.html index 52cb0c33fa..f1dc0033b2 100644 --- a/docs/RuntimeAPI/html/hip__vector__types_8h_source.html +++ b/docs/RuntimeAPI/html/hip__vector__types_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hip_vector_types.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hip_vector_types.h Source File @@ -116,18 +116,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  26 #include <hip_common.h>
                  27 
                  28 
                  -
                  29 #if defined(__HIP_PLATFORM_HCC__) and not defined (__HIP_PLATFORM_NVCC__)
                  - -
                  31 #elif defined(__HIP_PLATFORM_NVCC__) and not defined (__HIP_PLATFORM_HCC__)
                  -
                  32 #include <vector_types.h>
                  -
                  33 #else
                  -
                  34 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__");
                  -
                  35 #endif
                  +
                  29 #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__)
                  +
                  30 #if __cplusplus
                  + +
                  32 #endif
                  +
                  33 #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__)
                  +
                  34 #include <vector_types.h>
                  +
                  35 #else
                  +
                  36 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__");
                  +
                  37 #endif
                  Defines the different newt vector types for HIP runtime.
                  diff --git a/docs/RuntimeAPI/html/host__defines_8h.html b/docs/RuntimeAPI/html/host__defines_8h.html index 9a14820ade..872875a617 100644 --- a/docs/RuntimeAPI/html/host__defines_8h.html +++ b/docs/RuntimeAPI/html/host__defines_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/host_defines.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/host_defines.h File Reference @@ -139,7 +139,7 @@ Macros diff --git a/docs/RuntimeAPI/html/host__defines_8h_source.html b/docs/RuntimeAPI/html/host__defines_8h_source.html index 29d87ca30f..e99cb884f2 100644 --- a/docs/RuntimeAPI/html/host__defines_8h_source.html +++ b/docs/RuntimeAPI/html/host__defines_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/bensander/HIP-privatestaging/include/hcc_detail/host_defines.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/host_defines.h Source File @@ -111,47 +111,52 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  20 THE SOFTWARE.
                  21 */
                  22 
                  -
                  28 #ifdef __HCC__
                  -
                  29 
                  -
                  32 #define __host__ __attribute__((cpu))
                  -
                  33 #define __device__ __attribute__((hc))
                  -
                  34 
                  -
                  35 #ifndef DISABLE_GRID_LAUNCH
                  -
                  36 #define __global__ __attribute__((hc_grid_launch))
                  -
                  37 #else
                  -
                  38 #define __global__
                  -
                  39 #endif
                  -
                  40 
                  -
                  41 #define __noinline__ __attribute__((noinline))
                  -
                  42 #define __forceinline__ __attribute__((always_inline))
                  +
                  28 #ifndef HOST_DEFINES_H
                  +
                  29 #define HOST_DEFINES_H
                  +
                  30 
                  +
                  31 #ifdef __HCC__
                  +
                  32 
                  +
                  35 #define __host__ __attribute__((cpu))
                  +
                  36 #define __device__ __attribute__((hc))
                  +
                  37 
                  +
                  38 #ifndef DISABLE_GRID_LAUNCH
                  +
                  39 #define __global__ __attribute__((hc_grid_launch))
                  +
                  40 #else
                  +
                  41 #define __global__
                  +
                  42 #endif
                  43 
                  -
                  44 
                  -
                  45 
                  -
                  46 /*
                  -
                  47  * Variable Type Qualifiers:
                  -
                  48  */
                  -
                  49 // _restrict is supported by the compiler
                  -
                  50 #define __shared__ tile_static
                  -
                  51 #define __constant__ __attribute__((address_space(2)))
                  -
                  52 
                  -
                  53 #else
                  -
                  54 // Non-HCC compiler
                  -
                  58 #define __host__
                  -
                  59 #define __device__
                  -
                  60 
                  -
                  61 #define __global__
                  -
                  62 
                  -
                  63 #define __noinline__
                  -
                  64 #define __forceinline__
                  +
                  44 #define __noinline__ __attribute__((noinline))
                  +
                  45 #define __forceinline__ __attribute__((always_inline))
                  +
                  46 
                  +
                  47 
                  +
                  48 
                  +
                  49 /*
                  +
                  50  * Variable Type Qualifiers:
                  +
                  51  */
                  +
                  52 // _restrict is supported by the compiler
                  +
                  53 #define __shared__ tile_static
                  +
                  54 #define __constant__ __attribute__((address_space(2)))
                  +
                  55 
                  +
                  56 #else
                  +
                  57 // Non-HCC compiler
                  +
                  61 #define __host__
                  +
                  62 #define __device__
                  +
                  63 
                  +
                  64 #define __global__
                  65 
                  -
                  66 #define __shared__
                  -
                  67 #define __constant__
                  +
                  66 #define __noinline__
                  +
                  67 #define __forceinline__
                  68 
                  -
                  69 #endif
                  +
                  69 #define __shared__
                  +
                  70 #define __constant__
                  +
                  71 
                  +
                  72 #endif
                  +
                  73 
                  +
                  74 #endif
                  diff --git a/docs/RuntimeAPI/html/index.html b/docs/RuntimeAPI/html/index.html index 4797eae7a6..4cf966b886 100644 --- a/docs/RuntimeAPI/html/index.html +++ b/docs/RuntimeAPI/html/index.html @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/modules.html b/docs/RuntimeAPI/html/modules.html index 61a5a00089..2cc2f1d979 100644 --- a/docs/RuntimeAPI/html/modules.html +++ b/docs/RuntimeAPI/html/modules.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/pages.html b/docs/RuntimeAPI/html/pages.html index d09976f7e7..2a0866d812 100644 --- a/docs/RuntimeAPI/html/pages.html +++ b/docs/RuntimeAPI/html/pages.html @@ -88,7 +88,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/search/all_11.js b/docs/RuntimeAPI/html/search/all_11.js index 9043ae6945..bb8f6295d1 100644 --- a/docs/RuntimeAPI/html/search/all_11.js +++ b/docs/RuntimeAPI/html/search/all_11.js @@ -1,6 +1,6 @@ var searchData= [ - ['texture',['texture',['../structtexture.html',1,'texture< T, texType, hipTextureReadMode >'],['../group__Texture.html',1,'(Global Namespace)']]], + ['texture_20reference_20management',['Texture Reference Management',['../group__Texture.html',1,'']]], ['texturereference',['textureReference',['../structtextureReference.html',1,'']]], ['totalconstmem',['totalConstMem',['../structhipDeviceProp__t.html#a29880232c56120be3455ce00d5379665',1,'hipDeviceProp_t']]], ['totalglobalmem',['totalGlobalMem',['../structhipDeviceProp__t.html#acedd6a2d23423441e4bf51c4a1b719f9',1,'hipDeviceProp_t']]] diff --git a/docs/RuntimeAPI/html/search/groups_8.html b/docs/RuntimeAPI/html/search/all_15.html similarity index 94% rename from docs/RuntimeAPI/html/search/groups_8.html rename to docs/RuntimeAPI/html/search/all_15.html index 863d13654f..d3b5274ba7 100644 --- a/docs/RuntimeAPI/html/search/groups_8.html +++ b/docs/RuntimeAPI/html/search/all_15.html @@ -3,7 +3,7 @@ - + diff --git a/docs/RuntimeAPI/html/search/all_15.js b/docs/RuntimeAPI/html/search/all_15.js new file mode 100644 index 0000000000..e8bf38b99c --- /dev/null +++ b/docs/RuntimeAPI/html/search/all_15.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['z',['z',['../structdim3.html#a866e38993ecc4e76fd47311236c16b04',1,'dim3']]] +]; diff --git a/docs/RuntimeAPI/html/search/all_7.js b/docs/RuntimeAPI/html/search/all_7.js index 4bdb9b1c13..529e9394c3 100644 --- a/docs/RuntimeAPI/html/search/all_7.js +++ b/docs/RuntimeAPI/html/search/all_7.js @@ -1,5 +1,4 @@ var searchData= [ - ['getproperties',['getProperties',['../structihipDevice__t.html#a0abb382f1bcdda80028f9a8307e50561',1,'ihipDevice_t']]], ['global_20enum_20and_20defines',['Global enum and defines',['../group__GlobalDefs.html',1,'']]] ]; diff --git a/docs/RuntimeAPI/html/search/all_8.js b/docs/RuntimeAPI/html/search/all_8.js index 56dd3932c8..223696d7f7 100644 --- a/docs/RuntimeAPI/html/search/all_8.js +++ b/docs/RuntimeAPI/html/search/all_8.js @@ -21,12 +21,9 @@ var searchData= ['hcc_2dspecific_20accessors',['HCC-Specific Accessors',['../group__HCC__Specific.html',1,'']]], ['hip_20environment_20variables',['HIP Environment Variables',['../group__HIP-ENV.html',1,'']]], ['hip_5fhcc_2ecpp',['hip_hcc.cpp',['../hip__hcc_8cpp.html',1,'']]], - ['hip_5flaunch_5fblocking',['HIP_LAUNCH_BLOCKING',['../group__HIP-ENV.html#ga8049b329f2663b4572d81e7a9aa8a155',1,'HIP_LAUNCH_BLOCKING(): hip_hcc.cpp'],['../group__HIP-ENV.html#ga8049b329f2663b4572d81e7a9aa8a155',1,'HIP_LAUNCH_BLOCKING(): hip_hcc.cpp'],['../group__HIP-ENV.html#ga8049b329f2663b4572d81e7a9aa8a155',1,'HIP_LAUNCH_BLOCKING(): hip_hcc2.cpp']]], - ['hip_5fprint_5fenv',['HIP_PRINT_ENV',['../group__HIP-ENV.html#ga1e1c85dbb250f1acfb484c1be1f3b28a',1,'HIP_PRINT_ENV(): hip_hcc.cpp'],['../group__HIP-ENV.html#ga1e1c85dbb250f1acfb484c1be1f3b28a',1,'HIP_PRINT_ENV(): hip_hcc.cpp'],['../group__HIP-ENV.html#ga1e1c85dbb250f1acfb484c1be1f3b28a',1,'HIP_PRINT_ENV(): hip_hcc2.cpp']]], ['hip_5fruntime_2eh',['hip_runtime.h',['../hcc__detail_2hip__runtime_8h.html',1,'']]], ['hip_5fruntime_5fapi_2eh',['hip_runtime_api.h',['../hcc__detail_2hip__runtime__api_8h.html',1,'']]], ['hip_5ftexture_2eh',['hip_texture.h',['../hip__texture_8h.html',1,'']]], - ['hip_5ftrace_5fapi',['HIP_TRACE_API',['../group__HIP-ENV.html#gaae9c541f3e25b8f002762337a03fec28',1,'HIP_TRACE_API(): hip_hcc.cpp'],['../group__HIP-ENV.html#gaae9c541f3e25b8f002762337a03fec28',1,'HIP_TRACE_API(): hip_hcc.cpp'],['../group__HIP-ENV.html#gaae9c541f3e25b8f002762337a03fec28',1,'HIP_TRACE_API(): hip_hcc2.cpp']]], ['hip_5fvector_5ftypes_2eh',['hip_vector_types.h',['../hcc__detail_2hip__vector__types_8h.html',1,'']]], ['hipchannelformatdesc',['hipChannelFormatDesc',['../structhipChannelFormatDesc.html',1,'']]], ['hipdevicearch_5ft',['hipDeviceArch_t',['../structhipDeviceArch__t.html',1,'']]], @@ -56,18 +53,18 @@ var searchData= ['hipdeviceattributepcideviceid',['hipDeviceAttributePciDeviceId',['../group__GlobalDefs.html#ggacc0acd7b9bda126c6bb3dfd6e2796d7ca955d90286e87be9e3528f0b817ab32ff',1,'hip_runtime_api.h']]], ['hipdeviceattributetotalconstantmemory',['hipDeviceAttributeTotalConstantMemory',['../group__GlobalDefs.html#ggacc0acd7b9bda126c6bb3dfd6e2796d7cac6089ac3a0f9c77cc382fb0eaa73ae9c',1,'hip_runtime_api.h']]], ['hipdeviceattributewarpsize',['hipDeviceAttributeWarpSize',['../group__GlobalDefs.html#ggacc0acd7b9bda126c6bb3dfd6e2796d7caffd94133e823247a6f1215343232f6ec',1,'hip_runtime_api.h']]], - ['hipdevicecanaccesspeer',['hipDeviceCanAccessPeer',['../group__PeerToPeer.html#gab53a55dbc087ff659918fd04287de3d3',1,'hipDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice): hip_hcc.cpp'],['../group__PeerToPeer.html#gab53a55dbc087ff659918fd04287de3d3',1,'hipDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice): hip_hcc.cpp'],['../group__PeerToPeer.html#gab53a55dbc087ff659918fd04287de3d3',1,'hipDeviceCanAccessPeer(int *canAccessPeer, int device, int peerDevice): hip_hcc2.cpp']]], - ['hipdevicedisablepeeraccess',['hipDeviceDisablePeerAccess',['../group__PeerToPeer.html#ga41e60c01f63597529da1cd77bdd55379',1,'hipDeviceDisablePeerAccess(int peerDevice): hip_hcc.cpp'],['../group__PeerToPeer.html#ga41e60c01f63597529da1cd77bdd55379',1,'hipDeviceDisablePeerAccess(int peerDevice): hip_hcc.cpp'],['../group__PeerToPeer.html#ga41e60c01f63597529da1cd77bdd55379',1,'hipDeviceDisablePeerAccess(int peerDevice): hip_hcc2.cpp']]], - ['hipdeviceenablepeeraccess',['hipDeviceEnablePeerAccess',['../group__PeerToPeer.html#ga098e0d626edbfb69b66d141a5a8b7dc6',1,'hipDeviceEnablePeerAccess(int peerDevice, unsigned int flags): hip_hcc.cpp'],['../group__PeerToPeer.html#ga098e0d626edbfb69b66d141a5a8b7dc6',1,'hipDeviceEnablePeerAccess(int peerDevice, unsigned int flags): hip_hcc.cpp'],['../group__PeerToPeer.html#ga098e0d626edbfb69b66d141a5a8b7dc6',1,'hipDeviceEnablePeerAccess(int peerDevice, unsigned int flags): hip_hcc2.cpp']]], - ['hipdevicegetattribute',['hipDeviceGetAttribute',['../group__Device.html#gac49518ff2b26b98ea2ec9e9268761a24',1,'hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device): hip_hcc.cpp'],['../group__Device.html#gac49518ff2b26b98ea2ec9e9268761a24',1,'hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device): hip_hcc.cpp'],['../group__Device.html#gac49518ff2b26b98ea2ec9e9268761a24',1,'hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device): hip_hcc2.cpp']]], - ['hipdevicegetcacheconfig',['hipDeviceGetCacheConfig',['../group__Device.html#gaeeffa2456c5430400bea75ecd6ad1e68',1,'hipDeviceGetCacheConfig(hipFuncCache *cacheConfig): hip_hcc.cpp'],['../group__Device.html#gaeeffa2456c5430400bea75ecd6ad1e68',1,'hipDeviceGetCacheConfig(hipFuncCache *cacheConfig): hip_hcc.cpp'],['../group__Device.html#gaeeffa2456c5430400bea75ecd6ad1e68',1,'hipDeviceGetCacheConfig(hipFuncCache *cacheConfig): hip_hcc2.cpp']]], - ['hipdevicegetsharedmemconfig',['hipDeviceGetSharedMemConfig',['../group__Device.html#ga1bb08f774a34a468d969a8a04791c9bb',1,'hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig): hip_hcc.cpp'],['../group__Device.html#ga1bb08f774a34a468d969a8a04791c9bb',1,'hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig): hip_hcc.cpp'],['../group__Device.html#ga1bb08f774a34a468d969a8a04791c9bb',1,'hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig): hip_hcc2.cpp']]], + ['hipdevicecanaccesspeer',['hipDeviceCanAccessPeer',['../group__PeerToPeer.html#ga0a1c9ccd775758d9d7d5b5a1f525b719',1,'hipDeviceCanAccessPeer(int *canAccessPeer, int deviceId, int peerDeviceId): hip_peer.cpp'],['../group__PeerToPeer.html#ga0a1c9ccd775758d9d7d5b5a1f525b719',1,'hipDeviceCanAccessPeer(int *canAccessPeer, int deviceId, int peerDeviceId): hip_peer.cpp']]], + ['hipdevicedisablepeeraccess',['hipDeviceDisablePeerAccess',['../group__PeerToPeer.html#ga85030c72824fb60aaddc7374ab60481b',1,'hipDeviceDisablePeerAccess(int peerDeviceId): hip_peer.cpp'],['../group__PeerToPeer.html#ga85030c72824fb60aaddc7374ab60481b',1,'hipDeviceDisablePeerAccess(int peerDeviceId): hip_peer.cpp']]], + ['hipdeviceenablepeeraccess',['hipDeviceEnablePeerAccess',['../group__PeerToPeer.html#ga0caca59034134d7a7bb893cc1caa653e',1,'hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags): hip_peer.cpp'],['../group__PeerToPeer.html#ga0caca59034134d7a7bb893cc1caa653e',1,'hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags): hip_peer.cpp']]], + ['hipdevicegetattribute',['hipDeviceGetAttribute',['../group__Device.html#gac49518ff2b26b98ea2ec9e9268761a24',1,'hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device): hip_device.cpp'],['../group__Device.html#gac49518ff2b26b98ea2ec9e9268761a24',1,'hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device): hip_device.cpp']]], + ['hipdevicegetcacheconfig',['hipDeviceGetCacheConfig',['../group__Device.html#gaeeffa2456c5430400bea75ecd6ad1e68',1,'hipDeviceGetCacheConfig(hipFuncCache *cacheConfig): hip_device.cpp'],['../group__Device.html#gaeeffa2456c5430400bea75ecd6ad1e68',1,'hipDeviceGetCacheConfig(hipFuncCache *cacheConfig): hip_device.cpp']]], + ['hipdevicegetsharedmemconfig',['hipDeviceGetSharedMemConfig',['../group__Device.html#ga1bb08f774a34a468d969a8a04791c9bb',1,'hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig): hip_device.cpp'],['../group__Device.html#ga1bb08f774a34a468d969a8a04791c9bb',1,'hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig): hip_device.cpp']]], ['hipdeviceprop_5ft',['hipDeviceProp_t',['../structhipDeviceProp__t.html',1,'']]], - ['hipdevicereset',['hipDeviceReset',['../group__Device.html#ga8d57161ae56a8edc46eeda447417bf6c',1,'hipDeviceReset(void): hip_hcc.cpp'],['../group__Device.html#ga8d57161ae56a8edc46eeda447417bf6c',1,'hipDeviceReset(void): hip_hcc.cpp'],['../group__Device.html#ga8d57161ae56a8edc46eeda447417bf6c',1,'hipDeviceReset(void): hip_hcc2.cpp']]], - ['hipdevicesetcacheconfig',['hipDeviceSetCacheConfig',['../group__Device.html#gac2b282179f29c4c0ca7b5391242c6a4c',1,'hipDeviceSetCacheConfig(hipFuncCache cacheConfig): hip_hcc.cpp'],['../group__Device.html#gac2b282179f29c4c0ca7b5391242c6a4c',1,'hipDeviceSetCacheConfig(hipFuncCache cacheConfig): hip_hcc.cpp'],['../group__Device.html#gac2b282179f29c4c0ca7b5391242c6a4c',1,'hipDeviceSetCacheConfig(hipFuncCache cacheConfig): hip_hcc2.cpp']]], - ['hipdevicesetsharedmemconfig',['hipDeviceSetSharedMemConfig',['../group__Device.html#ga9b1f279084e76691cedfbfadf9c717ee',1,'hipDeviceSetSharedMemConfig(hipSharedMemConfig config): hip_hcc.cpp'],['../group__Device.html#ga9b1f279084e76691cedfbfadf9c717ee',1,'hipDeviceSetSharedMemConfig(hipSharedMemConfig config): hip_hcc.cpp'],['../group__Device.html#ga9b1f279084e76691cedfbfadf9c717ee',1,'hipDeviceSetSharedMemConfig(hipSharedMemConfig config): hip_hcc2.cpp']]], - ['hipdevicesynchronize',['hipDeviceSynchronize',['../group__Device.html#gaefdc2847fb1d6c3fb1354e827a191ebd',1,'hipDeviceSynchronize(void): hip_hcc.cpp'],['../group__Device.html#gaefdc2847fb1d6c3fb1354e827a191ebd',1,'hipDeviceSynchronize(void): hip_hcc.cpp'],['../group__Device.html#gaefdc2847fb1d6c3fb1354e827a191ebd',1,'hipDeviceSynchronize(void): hip_hcc2.cpp']]], - ['hipdrivergetversion',['hipDriverGetVersion',['../group__Version.html#gaf6c342f52d2a29a0aca5cdd89b4dd47c',1,'hipDriverGetVersion(int *driverVersion): hip_hcc.cpp'],['../group__Version.html#gaf6c342f52d2a29a0aca5cdd89b4dd47c',1,'hipDriverGetVersion(int *driverVersion): hip_hcc.cpp'],['../group__Version.html#gaf6c342f52d2a29a0aca5cdd89b4dd47c',1,'hipDriverGetVersion(int *driverVersion): hip_hcc2.cpp']]], + ['hipdevicereset',['hipDeviceReset',['../group__Device.html#ga8d57161ae56a8edc46eeda447417bf6c',1,'hipDeviceReset(void): hip_device.cpp'],['../group__Device.html#ga8d57161ae56a8edc46eeda447417bf6c',1,'hipDeviceReset(void): hip_device.cpp']]], + ['hipdevicesetcacheconfig',['hipDeviceSetCacheConfig',['../group__Device.html#gac2b282179f29c4c0ca7b5391242c6a4c',1,'hipDeviceSetCacheConfig(hipFuncCache cacheConfig): hip_device.cpp'],['../group__Device.html#gac2b282179f29c4c0ca7b5391242c6a4c',1,'hipDeviceSetCacheConfig(hipFuncCache cacheConfig): hip_device.cpp']]], + ['hipdevicesetsharedmemconfig',['hipDeviceSetSharedMemConfig',['../group__Device.html#ga9b1f279084e76691cedfbfadf9c717ee',1,'hipDeviceSetSharedMemConfig(hipSharedMemConfig config): hip_device.cpp'],['../group__Device.html#ga9b1f279084e76691cedfbfadf9c717ee',1,'hipDeviceSetSharedMemConfig(hipSharedMemConfig config): hip_device.cpp']]], + ['hipdevicesynchronize',['hipDeviceSynchronize',['../group__Device.html#gaefdc2847fb1d6c3fb1354e827a191ebd',1,'hipDeviceSynchronize(void): hip_device.cpp'],['../group__Device.html#gaefdc2847fb1d6c3fb1354e827a191ebd',1,'hipDeviceSynchronize(void): hip_device.cpp']]], + ['hipdrivergetversion',['hipDriverGetVersion',['../group__Version.html#gaf6c342f52d2a29a0aca5cdd89b4dd47c',1,'hipDriverGetVersion(int *driverVersion): hip_peer.cpp'],['../group__Version.html#gaf6c342f52d2a29a0aca5cdd89b4dd47c',1,'hipDriverGetVersion(int *driverVersion): hip_peer.cpp']]], ['hiperror_5ft',['hipError_t',['../group__GlobalDefs.html#gadf5010f6e140a53ecbdf949e73e87594',1,'hip_runtime_api.h']]], ['hiperrorinitializationerror',['hipErrorInitializationError',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a7e935ae88ee1f9ff3920156ac6864520',1,'hip_runtime_api.h']]], ['hiperrorinvaliddevice',['hipErrorInvalidDevice',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a07ab9b704ea693c1781a52741c60cd0d',1,'hip_runtime_api.h']]], @@ -80,6 +77,8 @@ var searchData= ['hiperrornodevice',['hipErrorNoDevice',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594ad4406972c318df36d231310a15131c24',1,'hip_runtime_api.h']]], ['hiperrornotready',['hipErrorNotReady',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594aa9638063c8746a9d1fda2b2069a0a9f1',1,'hip_runtime_api.h']]], ['hiperroroutofresources',['hipErrorOutOfResources',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a60c1c080b79bdde9ef5e808f974ac9ed',1,'hip_runtime_api.h']]], + ['hiperrorpeeraccessalreadyenabled',['hipErrorPeerAccessAlreadyEnabled',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a5399c146f91246f8b77abcd4ea30e7ac',1,'hip_runtime_api.h']]], + ['hiperrorpeeraccessnotenabled',['hipErrorPeerAccessNotEnabled',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a2ee0bf2e64840f253e4a1b12bbaf2d09',1,'hip_runtime_api.h']]], ['hiperrorruntimememory',['hipErrorRuntimeMemory',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a1159eb9a6be66bea740a8bfb61378723',1,'hip_runtime_api.h']]], ['hiperrorruntimeother',['hipErrorRuntimeOther',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a44f847c5914be2177feac107dcb096d1',1,'hip_runtime_api.h']]], ['hiperrortbd',['hipErrorTbd',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594ab556409e11ddb0c4cf77a2f4fc91ea9e',1,'hip_runtime_api.h']]], @@ -87,75 +86,78 @@ var searchData= ['hiperrorunknownsymbol',['hipErrorUnknownSymbol',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a45b297e6c3b2029dce1348658421481b',1,'hip_runtime_api.h']]], ['hipevent_5ft',['hipEvent_t',['../structhipEvent__t.html',1,'']]], ['hipeventblockingsync',['hipEventBlockingSync',['../group__GlobalDefs.html#gafa1c076a5b991763a98695063f1ea11d',1,'hip_runtime_api.h']]], - ['hipeventcreatewithflags',['hipEventCreateWithFlags',['../group__Event.html#gae86a5acb1b22b61bc9ecb9c28fc71b75',1,'hipEventCreateWithFlags(hipEvent_t *event, unsigned flags): hip_hcc.cpp'],['../group__Event.html#gae86a5acb1b22b61bc9ecb9c28fc71b75',1,'hipEventCreateWithFlags(hipEvent_t *event, unsigned flags): hip_hcc.cpp'],['../group__Event.html#gae86a5acb1b22b61bc9ecb9c28fc71b75',1,'hipEventCreateWithFlags(hipEvent_t *event, unsigned flags): hip_hcc2.cpp']]], + ['hipeventcreate',['hipEventCreate',['../group__Event.html#ga5df2309c9f29ca4c8e669db658d411b4',1,'hipEventCreate(hipEvent_t *event): hip_event.cpp'],['../group__Event.html#ga5df2309c9f29ca4c8e669db658d411b4',1,'hipEventCreate(hipEvent_t *event): hip_event.cpp']]], + ['hipeventcreatewithflags',['hipEventCreateWithFlags',['../group__Event.html#gae86a5acb1b22b61bc9ecb9c28fc71b75',1,'hipEventCreateWithFlags(hipEvent_t *event, unsigned flags): hip_event.cpp'],['../group__Event.html#gae86a5acb1b22b61bc9ecb9c28fc71b75',1,'hipEventCreateWithFlags(hipEvent_t *event, unsigned flags): hip_event.cpp']]], ['hipeventdefault',['hipEventDefault',['../group__GlobalDefs.html#ga122a5853359eba97cf047ddd153740f0',1,'hip_runtime_api.h']]], - ['hipeventdestroy',['hipEventDestroy',['../group__Event.html#ga83260357dce0c39e8c6a3c74ec97484c',1,'hipEventDestroy(hipEvent_t event): hip_hcc.cpp'],['../group__Event.html#ga83260357dce0c39e8c6a3c74ec97484c',1,'hipEventDestroy(hipEvent_t event): hip_hcc.cpp'],['../group__Event.html#ga83260357dce0c39e8c6a3c74ec97484c',1,'hipEventDestroy(hipEvent_t event): hip_hcc2.cpp']]], + ['hipeventdestroy',['hipEventDestroy',['../group__Event.html#ga83260357dce0c39e8c6a3c74ec97484c',1,'hipEventDestroy(hipEvent_t event): hip_event.cpp'],['../group__Event.html#ga83260357dce0c39e8c6a3c74ec97484c',1,'hipEventDestroy(hipEvent_t event): hip_event.cpp']]], ['hipeventdisabletiming',['hipEventDisableTiming',['../group__GlobalDefs.html#ga3c0f44a85e36a4c67671da6bcdad0351',1,'hip_runtime_api.h']]], - ['hipeventelapsedtime',['hipEventElapsedTime',['../group__Event.html#gad4128b815cb475c8e13c7e66ff6250b7',1,'hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop): hip_hcc.cpp'],['../group__Event.html#gad4128b815cb475c8e13c7e66ff6250b7',1,'hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop): hip_hcc.cpp'],['../group__Event.html#gad4128b815cb475c8e13c7e66ff6250b7',1,'hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop): hip_hcc2.cpp']]], + ['hipeventelapsedtime',['hipEventElapsedTime',['../group__Event.html#gad4128b815cb475c8e13c7e66ff6250b7',1,'hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop): hip_event.cpp'],['../group__Event.html#gad4128b815cb475c8e13c7e66ff6250b7',1,'hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop): hip_event.cpp']]], ['hipeventinterprocess',['hipEventInterprocess',['../group__GlobalDefs.html#ga0f01d74059baa704e42aeff8222166bb',1,'hip_runtime_api.h']]], - ['hipeventquery',['hipEventQuery',['../group__Event.html#ga5d12d7b798b5ceb5932d1ac21f5ac776',1,'hipEventQuery(hipEvent_t event): hip_hcc.cpp'],['../group__Event.html#ga5d12d7b798b5ceb5932d1ac21f5ac776',1,'hipEventQuery(hipEvent_t event): hip_hcc.cpp'],['../group__Event.html#ga5d12d7b798b5ceb5932d1ac21f5ac776',1,'hipEventQuery(hipEvent_t event): hip_hcc2.cpp']]], - ['hipeventrecord',['hipEventRecord',['../group__Event.html#gace88ebd8c7ec42a6c2cebda2e8b0cb38',1,'hipEventRecord(hipEvent_t event, hipStream_t stream=NULL): hip_hcc.cpp'],['../group__Event.html#gace88ebd8c7ec42a6c2cebda2e8b0cb38',1,'hipEventRecord(hipEvent_t event, hipStream_t stream): hip_hcc.cpp'],['../group__Event.html#gace88ebd8c7ec42a6c2cebda2e8b0cb38',1,'hipEventRecord(hipEvent_t event, hipStream_t stream): hip_hcc2.cpp']]], - ['hipeventsynchronize',['hipEventSynchronize',['../group__Event.html#ga1f72d98ba5d6f7dc3da54e0c41fe38b1',1,'hipEventSynchronize(hipEvent_t event): hip_hcc.cpp'],['../group__Event.html#ga1f72d98ba5d6f7dc3da54e0c41fe38b1',1,'hipEventSynchronize(hipEvent_t event): hip_hcc.cpp'],['../group__Event.html#ga1f72d98ba5d6f7dc3da54e0c41fe38b1',1,'hipEventSynchronize(hipEvent_t event): hip_hcc2.cpp']]], + ['hipeventquery',['hipEventQuery',['../group__Event.html#ga5d12d7b798b5ceb5932d1ac21f5ac776',1,'hipEventQuery(hipEvent_t event): hip_event.cpp'],['../group__Event.html#ga5d12d7b798b5ceb5932d1ac21f5ac776',1,'hipEventQuery(hipEvent_t event): hip_event.cpp']]], + ['hipeventrecord',['hipEventRecord',['../group__Event.html#ga553b6f7a8e7b7dd9536d8a64c24d7e29',1,'hipEventRecord(hipEvent_t event, hipStream_t stream): hip_event.cpp'],['../group__Event.html#ga553b6f7a8e7b7dd9536d8a64c24d7e29',1,'hipEventRecord(hipEvent_t event, hipStream_t stream): hip_event.cpp']]], + ['hipeventsynchronize',['hipEventSynchronize',['../group__Event.html#ga1f72d98ba5d6f7dc3da54e0c41fe38b1',1,'hipEventSynchronize(hipEvent_t event): hip_event.cpp'],['../group__Event.html#ga1f72d98ba5d6f7dc3da54e0c41fe38b1',1,'hipEventSynchronize(hipEvent_t event): hip_event.cpp']]], ['hipfiltermodepoint',['hipFilterModePoint',['../hip__texture_8h.html#aa2f0b6002b81d0a43a808cb880bb21e6a56ede038ab7c805ec4b5b61d2b678dfc',1,'hip_texture.h']]], - ['hipfree',['hipFree',['../group__Memory.html#ga740d08da65cae1441ba32f8fedb863d1',1,'hipFree(void *ptr): hip_hcc.cpp'],['../group__Memory.html#ga740d08da65cae1441ba32f8fedb863d1',1,'hipFree(void *ptr): hip_hcc.cpp'],['../group__Memory.html#ga740d08da65cae1441ba32f8fedb863d1',1,'hipFree(void *ptr): hip_hcc2.cpp']]], - ['hipfreehost',['hipFreeHost',['../group__Memory.html#gad2164cc3d49da53052f4b83b789e90c9',1,'hipFreeHost(void *ptr) __attribute__((deprecated("use hipHostFree instead"))): hip_hcc.cpp'],['../group__Memory.html#gad2164cc3d49da53052f4b83b789e90c9',1,'hipFreeHost(void *ptr): hip_hcc.cpp'],['../group__Memory.html#gad2164cc3d49da53052f4b83b789e90c9',1,'hipFreeHost(void *ptr): hip_hcc2.cpp']]], + ['hipfree',['hipFree',['../group__Memory.html#ga740d08da65cae1441ba32f8fedb863d1',1,'hipFree(void *ptr): hip_memory.cpp'],['../group__Memory.html#ga740d08da65cae1441ba32f8fedb863d1',1,'hipFree(void *ptr): hip_memory.cpp']]], + ['hipfreehost',['hipFreeHost',['../group__Memory.html#gad2164cc3d49da53052f4b83b789e90c9',1,'hipFreeHost(void *ptr) __attribute__((deprecated("use hipHostFree instead"))): hip_memory.cpp'],['../group__Memory.html#gad2164cc3d49da53052f4b83b789e90c9',1,'hipFreeHost(void *ptr): hip_memory.cpp']]], ['hipfunccache',['hipFuncCache',['../group__GlobalDefs.html#gac7e4bfd88340fc06642136c839a3d822',1,'hipFuncCache(): hip_runtime_api.h'],['../group__GlobalDefs.html#gaad15dc7939a0a25b16e4aa161fb41eee',1,'hipFuncCache(): hip_runtime_api.h']]], ['hipfunccachepreferequal',['hipFuncCachePreferEqual',['../group__GlobalDefs.html#ggac7e4bfd88340fc06642136c839a3d822a0ddab0e840107634a152033103be44d7',1,'hip_runtime_api.h']]], ['hipfunccachepreferl1',['hipFuncCachePreferL1',['../group__GlobalDefs.html#ggac7e4bfd88340fc06642136c839a3d822a636a3c140db6b9d4a8bf7d5a61c398c5',1,'hip_runtime_api.h']]], ['hipfunccacheprefernone',['hipFuncCachePreferNone',['../group__GlobalDefs.html#ggac7e4bfd88340fc06642136c839a3d822a0813fbaa008ce1231ff9fed3911eb3af',1,'hip_runtime_api.h']]], ['hipfunccacheprefershared',['hipFuncCachePreferShared',['../group__GlobalDefs.html#ggac7e4bfd88340fc06642136c839a3d822a9b34337dfbadba25ed2aa270bbcabc43',1,'hip_runtime_api.h']]], - ['hipfuncsetcacheconfig',['hipFuncSetCacheConfig',['../group__Device.html#gadd94a910c2b840833cc325b1e5425702',1,'hipFuncSetCacheConfig(hipFuncCache config): hip_hcc.cpp'],['../group__Device.html#gadd94a910c2b840833cc325b1e5425702',1,'hipFuncSetCacheConfig(hipFuncCache cacheConfig): hip_hcc.cpp'],['../group__Device.html#gadd94a910c2b840833cc325b1e5425702',1,'hipFuncSetCacheConfig(hipFuncCache cacheConfig): hip_hcc2.cpp']]], - ['hipgetdevice',['hipGetDevice',['../group__Device.html#gaffc83567f2df3bbe2d37a19872d60f24',1,'hipGetDevice(int *device): hip_hcc.cpp'],['../group__Device.html#gaffc83567f2df3bbe2d37a19872d60f24',1,'hipGetDevice(int *device): hip_hcc.cpp'],['../group__Device.html#gaffc83567f2df3bbe2d37a19872d60f24',1,'hipGetDevice(int *device): hip_hcc2.cpp']]], - ['hipgetdevicecount',['hipGetDeviceCount',['../group__Device.html#ga8555d5c76d88c50ddbf54ae70b568394',1,'hipGetDeviceCount(int *count): hip_hcc.cpp'],['../group__Device.html#ga8555d5c76d88c50ddbf54ae70b568394',1,'hipGetDeviceCount(int *count): hip_hcc.cpp'],['../group__Device.html#ga8555d5c76d88c50ddbf54ae70b568394',1,'hipGetDeviceCount(int *count): hip_hcc2.cpp']]], - ['hipgetdeviceproperties',['hipGetDeviceProperties',['../group__Device.html#ga77c20744e2a88c31440992d6c7754b5f',1,'hipGetDeviceProperties(hipDeviceProp_t *prop, int device): hip_hcc.cpp'],['../group__Device.html#ga77c20744e2a88c31440992d6c7754b5f',1,'hipGetDeviceProperties(hipDeviceProp_t *props, int device): hip_hcc.cpp'],['../group__Device.html#ga77c20744e2a88c31440992d6c7754b5f',1,'hipGetDeviceProperties(hipDeviceProp_t *props, int device): hip_hcc2.cpp']]], - ['hipgeterrorname',['hipGetErrorName',['../group__Error.html#ga88c474d77635523dbf6ca67be7b56999',1,'hipGetErrorName(hipError_t hip_error): hip_hcc.cpp'],['../group__Error.html#ga88c474d77635523dbf6ca67be7b56999',1,'hipGetErrorName(hipError_t hip_error): hip_hcc.cpp'],['../group__Error.html#ga88c474d77635523dbf6ca67be7b56999',1,'hipGetErrorName(hipError_t hip_error): hip_hcc2.cpp']]], - ['hipgeterrorstring',['hipGetErrorString',['../group__Error.html#ga5959779a654bbc98ffe6d36ab536740a',1,'hipGetErrorString(hipError_t hip_error): hip_hcc.cpp'],['../group__Error.html#ga5959779a654bbc98ffe6d36ab536740a',1,'hipGetErrorString(hipError_t hip_error): hip_hcc.cpp'],['../group__Error.html#ga5959779a654bbc98ffe6d36ab536740a',1,'hipGetErrorString(hipError_t hip_error): hip_hcc2.cpp']]], - ['hipgetlasterror',['hipGetLastError',['../group__Error.html#ga533daeb9114d7fc2db8d867adf9e419b',1,'hipGetLastError(void): hip_hcc.cpp'],['../group__Error.html#ga533daeb9114d7fc2db8d867adf9e419b',1,'hipGetLastError(): hip_hcc.cpp'],['../group__Error.html#ga533daeb9114d7fc2db8d867adf9e419b',1,'hipGetLastError(): hip_hcc2.cpp']]], - ['hiphccgetaccelerator',['hipHccGetAccelerator',['../group__HCC__Specific.html#ga0d24b3157fd1b16d38672bb157ec4cd4',1,'hipHccGetAccelerator(int deviceId, hc::accelerator *acc): hip_hcc.cpp'],['../group__HCC__Specific.html#ga0d24b3157fd1b16d38672bb157ec4cd4',1,'hipHccGetAccelerator(int deviceId, hc::accelerator *acc): hip_hcc.cpp'],['../group__HCC__Specific.html#ga0d24b3157fd1b16d38672bb157ec4cd4',1,'hipHccGetAccelerator(int deviceId, hc::accelerator *acc): hip_hcc2.cpp']]], - ['hiphccgetacceleratorview',['hipHccGetAcceleratorView',['../group__HCC__Specific.html#ga1a7087ea9c3c3323270d7cce73650b44',1,'hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av): hip_hcc.cpp'],['../group__HCC__Specific.html#ga1a7087ea9c3c3323270d7cce73650b44',1,'hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av): hip_hcc.cpp'],['../group__HCC__Specific.html#ga1a7087ea9c3c3323270d7cce73650b44',1,'hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av): hip_hcc2.cpp']]], - ['hiphostfree',['hipHostFree',['../group__Memory.html#ga2e543f58ee4544e317cd695d6d82e0a3',1,'hipHostFree(void *ptr): hip_hcc.cpp'],['../group__Memory.html#ga2e543f58ee4544e317cd695d6d82e0a3',1,'hipHostFree(void *ptr): hip_hcc.cpp']]], - ['hiphostgetdevicepointer',['hipHostGetDevicePointer',['../group__Memory.html#ga8fa7a0478020b835a24785cd6bb89725',1,'hipHostGetDevicePointer(void **devPtr, void *hstPtr, unsigned int flags): hip_runtime_api.h'],['../hip__hcc_8cpp.html#a59f9f57c495531c8bb12f506e915399e',1,'hipHostGetDevicePointer(void **devicePointer, void *hostPointer, unsigned flags): hip_hcc.cpp']]], - ['hiphostgetflags',['hipHostGetFlags',['../group__Memory.html#ga4d26915873b3e3534ceb4dc310f8709a',1,'hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr): hip_hcc.cpp'],['../group__Memory.html#ga4d26915873b3e3534ceb4dc310f8709a',1,'hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr): hip_hcc.cpp'],['../group__Memory.html#ga4d26915873b3e3534ceb4dc310f8709a',1,'hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr): hip_hcc2.cpp']]], - ['hiphostmalloc',['hipHostMalloc',['../group__Memory.html#gaad40bc7d97ccc799403ef5a9a8c246e1',1,'hipHostMalloc(void **ptr, size_t size, unsigned int flags): hip_hcc.cpp'],['../group__Memory.html#gaad40bc7d97ccc799403ef5a9a8c246e1',1,'hipHostMalloc(void **ptr, size_t sizeBytes, unsigned int flags): hip_hcc.cpp']]], + ['hipfuncsetcacheconfig',['hipFuncSetCacheConfig',['../group__Device.html#gadd94a910c2b840833cc325b1e5425702',1,'hipFuncSetCacheConfig(hipFuncCache config): hip_device.cpp'],['../group__Device.html#gadd94a910c2b840833cc325b1e5425702',1,'hipFuncSetCacheConfig(hipFuncCache cacheConfig): hip_device.cpp']]], + ['hipgetdevice',['hipGetDevice',['../group__Device.html#gaffc83567f2df3bbe2d37a19872d60f24',1,'hipGetDevice(int *device): hip_device.cpp'],['../group__Device.html#gaffc83567f2df3bbe2d37a19872d60f24',1,'hipGetDevice(int *device): hip_device.cpp']]], + ['hipgetdevicecount',['hipGetDeviceCount',['../group__Device.html#ga8555d5c76d88c50ddbf54ae70b568394',1,'hipGetDeviceCount(int *count): hip_device.cpp'],['../group__Device.html#ga8555d5c76d88c50ddbf54ae70b568394',1,'hipGetDeviceCount(int *count): hip_device.cpp']]], + ['hipgetdeviceproperties',['hipGetDeviceProperties',['../group__Device.html#ga77c20744e2a88c31440992d6c7754b5f',1,'hipGetDeviceProperties(hipDeviceProp_t *prop, int device): hip_device.cpp'],['../group__Device.html#ga77c20744e2a88c31440992d6c7754b5f',1,'hipGetDeviceProperties(hipDeviceProp_t *props, int device): hip_device.cpp']]], + ['hipgeterrorname',['hipGetErrorName',['../group__Error.html#ga88c474d77635523dbf6ca67be7b56999',1,'hipGetErrorName(hipError_t hip_error): hip_error.cpp'],['../group__Error.html#ga88c474d77635523dbf6ca67be7b56999',1,'hipGetErrorName(hipError_t hip_error): hip_error.cpp']]], + ['hipgeterrorstring',['hipGetErrorString',['../group__Error.html#ga5959779a654bbc98ffe6d36ab536740a',1,'hipGetErrorString(hipError_t hip_error): hip_error.cpp'],['../group__Error.html#ga5959779a654bbc98ffe6d36ab536740a',1,'hipGetErrorString(hipError_t hip_error): hip_error.cpp']]], + ['hipgetlasterror',['hipGetLastError',['../group__Error.html#ga533daeb9114d7fc2db8d867adf9e419b',1,'hipGetLastError(void): hip_error.cpp'],['../group__Error.html#ga533daeb9114d7fc2db8d867adf9e419b',1,'hipGetLastError(): hip_error.cpp']]], + ['hiphccgetaccelerator',['hipHccGetAccelerator',['../hip__hcc_8cpp.html#a0d24b3157fd1b16d38672bb157ec4cd4',1,'hip_hcc.cpp']]], + ['hiphccgetacceleratorview',['hipHccGetAcceleratorView',['../hip__hcc_8cpp.html#a1a7087ea9c3c3323270d7cce73650b44',1,'hip_hcc.cpp']]], + ['hiphostfree',['hipHostFree',['../group__Memory.html#ga2e543f58ee4544e317cd695d6d82e0a3',1,'hipHostFree(void *ptr): hip_memory.cpp'],['../group__Memory.html#ga2e543f58ee4544e317cd695d6d82e0a3',1,'hipHostFree(void *ptr): hip_memory.cpp']]], + ['hiphostgetdevicepointer',['hipHostGetDevicePointer',['../group__Memory.html#ga8fa7a0478020b835a24785cd6bb89725',1,'hip_runtime_api.h']]], + ['hiphostgetflags',['hipHostGetFlags',['../group__Memory.html#ga4d26915873b3e3534ceb4dc310f8709a',1,'hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr): hip_memory.cpp'],['../group__Memory.html#ga4d26915873b3e3534ceb4dc310f8709a',1,'hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr): hip_memory.cpp']]], + ['hiphostmalloc',['hipHostMalloc',['../group__Memory.html#gaad40bc7d97ccc799403ef5a9a8c246e1',1,'hipHostMalloc(void **ptr, size_t size, unsigned int flags): hip_memory.cpp'],['../group__Memory.html#gaad40bc7d97ccc799403ef5a9a8c246e1',1,'hipHostMalloc(void **ptr, size_t sizeBytes, unsigned int flags): hip_memory.cpp']]], ['hiphostmallocdefault',['hipHostMallocDefault',['../group__GlobalDefs.html#gad594ec51cb5b5e946c1e354bf80bddc7',1,'hip_runtime_api.h']]], - ['hiphostregister',['hipHostRegister',['../group__Memory.html#gab8258f051e1a1f7385f794a15300e674',1,'hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags): hip_hcc.cpp'],['../group__Memory.html#gab8258f051e1a1f7385f794a15300e674',1,'hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags): hip_hcc.cpp'],['../group__Memory.html#gab8258f051e1a1f7385f794a15300e674',1,'hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags): hip_hcc2.cpp']]], + ['hiphostregister',['hipHostRegister',['../group__Memory.html#gab8258f051e1a1f7385f794a15300e674',1,'hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags): hip_memory.cpp'],['../group__Memory.html#gab8258f051e1a1f7385f794a15300e674',1,'hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags): hip_memory.cpp']]], ['hiphostregisterdefault',['hipHostRegisterDefault',['../group__GlobalDefs.html#gac7c100d241ff84ad10109bb00b7b25dc',1,'hip_runtime_api.h']]], ['hiphostregisteriomemory',['hipHostRegisterIoMemory',['../group__GlobalDefs.html#gaefa79f1b4481d6a1d1091c14b24f33d0',1,'hip_runtime_api.h']]], ['hiphostregistermapped',['hipHostRegisterMapped',['../group__GlobalDefs.html#gacfa4edcfcb39fc61bff6bdecb14d7618',1,'hip_runtime_api.h']]], ['hiphostregisterportable',['hipHostRegisterPortable',['../group__GlobalDefs.html#ga2db444f2315d412d3c7ba80ec6049583',1,'hip_runtime_api.h']]], - ['hiphostunregister',['hipHostUnregister',['../group__Memory.html#ga4c9e1810b9f5858d36c4d28c91c86924',1,'hipHostUnregister(void *hostPtr): hip_hcc.cpp'],['../group__Memory.html#ga4c9e1810b9f5858d36c4d28c91c86924',1,'hipHostUnregister(void *hostPtr): hip_hcc.cpp'],['../group__Memory.html#ga4c9e1810b9f5858d36c4d28c91c86924',1,'hipHostUnregister(void *hostPtr): hip_hcc2.cpp']]], - ['hipmalloc',['hipMalloc',['../group__Memory.html#ga4c6fcfe80010069d2792780d00dcead2',1,'hipMalloc(void **ptr, size_t size): hip_hcc.cpp'],['../group__Memory.html#ga4c6fcfe80010069d2792780d00dcead2',1,'hipMalloc(void **ptr, size_t sizeBytes): hip_hcc.cpp'],['../group__Memory.html#ga4c6fcfe80010069d2792780d00dcead2',1,'hipMalloc(void **ptr, size_t sizeBytes): hip_hcc2.cpp']]], - ['hipmallochost',['hipMallocHost',['../group__Memory.html#gad3d3cdf82eb0058fc9eac1f939cd9d30',1,'hipMallocHost(void **ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead"))): hip_hcc.cpp'],['../group__Memory.html#gad3d3cdf82eb0058fc9eac1f939cd9d30',1,'hipMallocHost(void **ptr, size_t sizeBytes): hip_hcc.cpp'],['../group__Memory.html#gad3d3cdf82eb0058fc9eac1f939cd9d30',1,'hipMallocHost(void **ptr, size_t sizeBytes): hip_hcc2.cpp']]], - ['hipmemcpy',['hipMemcpy',['../group__Memory.html#gac1a055d288302edd641c6d7416858e1e',1,'hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind): hip_hcc.cpp'],['../group__Memory.html#gac1a055d288302edd641c6d7416858e1e',1,'hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind): hip_hcc.cpp'],['../group__Memory.html#gac1a055d288302edd641c6d7416858e1e',1,'hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind): hip_hcc2.cpp']]], - ['hipmemcpyasync',['hipMemcpyAsync',['../group__Memory.html#ga8ad5a0b13458917e1b9437732b21af54',1,'hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream=0): hip_hcc.cpp'],['../group__Memory.html#ga8ad5a0b13458917e1b9437732b21af54',1,'hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream): hip_hcc.cpp'],['../group__Memory.html#ga8ad5a0b13458917e1b9437732b21af54',1,'hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream): hip_hcc2.cpp']]], + ['hiphostunregister',['hipHostUnregister',['../group__Memory.html#ga4c9e1810b9f5858d36c4d28c91c86924',1,'hipHostUnregister(void *hostPtr): hip_memory.cpp'],['../group__Memory.html#ga4c9e1810b9f5858d36c4d28c91c86924',1,'hipHostUnregister(void *hostPtr): hip_memory.cpp']]], + ['hipmalloc',['hipMalloc',['../group__Memory.html#ga4c6fcfe80010069d2792780d00dcead2',1,'hipMalloc(void **ptr, size_t size): hip_memory.cpp'],['../group__Memory.html#ga4c6fcfe80010069d2792780d00dcead2',1,'hipMalloc(void **ptr, size_t sizeBytes): hip_memory.cpp']]], + ['hipmallochost',['hipMallocHost',['../group__Memory.html#gad3d3cdf82eb0058fc9eac1f939cd9d30',1,'hipMallocHost(void **ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead"))): hip_memory.cpp'],['../group__Memory.html#gad3d3cdf82eb0058fc9eac1f939cd9d30',1,'hipMallocHost(void **ptr, size_t sizeBytes): hip_memory.cpp']]], + ['hipmemcpy',['hipMemcpy',['../group__Memory.html#gac1a055d288302edd641c6d7416858e1e',1,'hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind): hip_memory.cpp'],['../group__Memory.html#gac1a055d288302edd641c6d7416858e1e',1,'hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind): hip_memory.cpp']]], + ['hipmemcpyasync',['hipMemcpyAsync',['../group__Memory.html#gad55fa9f5980b711bc93c52820149ba18',1,'hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream): hip_memory.cpp'],['../group__Memory.html#gad55fa9f5980b711bc93c52820149ba18',1,'hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream): hip_memory.cpp']]], ['hipmemcpydefault',['hipMemcpyDefault',['../group__GlobalDefs.html#gga232e222db36b1fc672ba98054d036a18a4e37107e416f79a2edf2b6534163c823',1,'hip_runtime_api.h']]], ['hipmemcpydevicetodevice',['hipMemcpyDeviceToDevice',['../group__GlobalDefs.html#gga232e222db36b1fc672ba98054d036a18abd05a09d3105e0ce25b34dd91cf83f88',1,'hip_runtime_api.h']]], ['hipmemcpydevicetohost',['hipMemcpyDeviceToHost',['../group__GlobalDefs.html#gga232e222db36b1fc672ba98054d036a18aba2505e9ce1e5382f17730bc670917d1',1,'hip_runtime_api.h']]], ['hipmemcpyhosttodevice',['hipMemcpyHostToDevice',['../group__GlobalDefs.html#gga232e222db36b1fc672ba98054d036a18aff32175ecb0c7113200286eff8211008',1,'hip_runtime_api.h']]], ['hipmemcpyhosttohost',['hipMemcpyHostToHost',['../group__GlobalDefs.html#gga232e222db36b1fc672ba98054d036a18a9d66b705aa85a9c83f0f533cef70d0af',1,'hip_runtime_api.h']]], - ['hipmemcpykind',['hipMemcpyKind',['../group__GlobalDefs.html#ga232e222db36b1fc672ba98054d036a18',1,'hip_runtime_api.h']]], - ['hipmemcpypeer',['hipMemcpyPeer',['../group__PeerToPeer.html#ga72ae9e7f498ab5684580892a5d7d8e2d',1,'hipMemcpyPeer(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes): hip_hcc.cpp'],['../group__PeerToPeer.html#ga72ae9e7f498ab5684580892a5d7d8e2d',1,'hipMemcpyPeer(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes): hip_hcc.cpp'],['../group__PeerToPeer.html#ga72ae9e7f498ab5684580892a5d7d8e2d',1,'hipMemcpyPeer(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes): hip_hcc2.cpp']]], - ['hipmemcpypeerasync',['hipMemcpyPeerAsync',['../group__PeerToPeer.html#gab6211c18ca1e23252ef080cd6be855ca',1,'hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream=0): hip_hcc.cpp'],['../group__PeerToPeer.html#gab6211c18ca1e23252ef080cd6be855ca',1,'hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream): hip_hcc.cpp'],['../group__PeerToPeer.html#gab6211c18ca1e23252ef080cd6be855ca',1,'hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream): hip_hcc2.cpp']]], - ['hipmemcpytosymbol',['hipMemcpyToSymbol',['../group__Memory.html#ga131ac5c1ba04e186112491cb9bf964bc',1,'hipMemcpyToSymbol(const char *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind): hip_hcc.cpp'],['../group__Memory.html#ga131ac5c1ba04e186112491cb9bf964bc',1,'hipMemcpyToSymbol(const char *symbolName, const void *src, size_t count, size_t offset, hipMemcpyKind kind): hip_hcc.cpp'],['../group__Memory.html#ga131ac5c1ba04e186112491cb9bf964bc',1,'hipMemcpyToSymbol(const char *symbolName, const void *src, size_t count, size_t offset, hipMemcpyKind kind): hip_hcc2.cpp']]], - ['hipmemgetinfo',['hipMemGetInfo',['../group__Memory.html#ga311c3e246a21590de14478b8bd063be2',1,'hipMemGetInfo(size_t *free, size_t *total): hip_hcc.cpp'],['../group__Memory.html#ga311c3e246a21590de14478b8bd063be2',1,'hipMemGetInfo(size_t *free, size_t *total): hip_hcc.cpp'],['../group__Memory.html#ga311c3e246a21590de14478b8bd063be2',1,'hipMemGetInfo(size_t *free, size_t *total): hip_hcc2.cpp']]], - ['hipmemset',['hipMemset',['../group__Memory.html#gac7441e74affcce4b8b69dba996c5ebc4',1,'hipMemset(void *dst, int value, size_t sizeBytes): hip_hcc.cpp'],['../group__Memory.html#gac7441e74affcce4b8b69dba996c5ebc4',1,'hipMemset(void *dst, int value, size_t sizeBytes): hip_hcc.cpp'],['../group__Memory.html#gac7441e74affcce4b8b69dba996c5ebc4',1,'hipMemset(void *dst, int value, size_t sizeBytes): hip_hcc2.cpp']]], - ['hipmemsetasync',['hipMemsetAsync',['../group__Memory.html#gaee4ed665ce0a60c661a809c175320a0c',1,'hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t=0): hip_hcc.cpp'],['../group__Memory.html#gaee4ed665ce0a60c661a809c175320a0c',1,'hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t stream): hip_hcc.cpp'],['../group__Memory.html#gaee4ed665ce0a60c661a809c175320a0c',1,'hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t stream): hip_hcc2.cpp']]], + ['hipmemcpykind',['hipMemcpyKind',['../group__GlobalDefs.html#ga232e222db36b1fc672ba98054d036a18',1,'hipMemcpyKind(): hip_runtime_api.h'],['../group__GlobalDefs.html#ga0c04e67413ce030817361f02673e5c85',1,'hipMemcpyKind(): hip_runtime_api.h']]], + ['hipmemcpypeer',['hipMemcpyPeer',['../group__PeerToPeer.html#ga5512f45e25c08052667c8ffe7162333b',1,'hipMemcpyPeer(void *dst, int dstDeviceId, const void *src, int srcDeviceId, size_t sizeBytes): hip_peer.cpp'],['../group__PeerToPeer.html#ga5512f45e25c08052667c8ffe7162333b',1,'hipMemcpyPeer(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes): hip_peer.cpp']]], + ['hipmemcpypeerasync',['hipMemcpyPeerAsync',['../group__PeerToPeer.html#ga216f951370c931d22e80c089ab724ed9',1,'hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream): hip_peer.cpp'],['../group__PeerToPeer.html#ga216f951370c931d22e80c089ab724ed9',1,'hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream): hip_peer.cpp']]], + ['hipmemcpytosymbol',['hipMemcpyToSymbol',['../group__Memory.html#ga131ac5c1ba04e186112491cb9bf964bc',1,'hipMemcpyToSymbol(const char *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind): hip_memory.cpp'],['../group__Memory.html#ga131ac5c1ba04e186112491cb9bf964bc',1,'hipMemcpyToSymbol(const char *symbolName, const void *src, size_t count, size_t offset, hipMemcpyKind kind): hip_memory.cpp']]], + ['hipmemgetinfo',['hipMemGetInfo',['../group__Memory.html#ga311c3e246a21590de14478b8bd063be2',1,'hipMemGetInfo(size_t *free, size_t *total): hip_memory.cpp'],['../group__Memory.html#ga311c3e246a21590de14478b8bd063be2',1,'hipMemGetInfo(size_t *free, size_t *total): hip_memory.cpp']]], + ['hipmemset',['hipMemset',['../group__Memory.html#gac7441e74affcce4b8b69dba996c5ebc4',1,'hipMemset(void *dst, int value, size_t sizeBytes): hip_memory.cpp'],['../group__Memory.html#gac7441e74affcce4b8b69dba996c5ebc4',1,'hipMemset(void *dst, int value, size_t sizeBytes): hip_memory.cpp']]], + ['hipmemsetasync',['hipMemsetAsync',['../group__Memory.html#gae7d90e14c387e49f10db597f12915c54',1,'hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t stream): hip_memory.cpp'],['../group__Memory.html#gae7d90e14c387e49f10db597f12915c54',1,'hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t stream): hip_memory.cpp']]], ['hippeekatlasterror',['hipPeekAtLastError',['../group__Error.html#ga1dd660bc739f7e13edd34615660f0148',1,'hip_runtime_api.h']]], ['hippointerattribute_5ft',['hipPointerAttribute_t',['../structhipPointerAttribute__t.html',1,'']]], - ['hippointergetattributes',['hipPointerGetAttributes',['../group__Memory.html#ga3d68ba64959615d4ab84f10caa12433b',1,'hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr): hip_hcc.cpp'],['../group__Memory.html#ga3d68ba64959615d4ab84f10caa12433b',1,'hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr): hip_hcc.cpp'],['../group__Memory.html#ga3d68ba64959615d4ab84f10caa12433b',1,'hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr): hip_hcc2.cpp']]], + ['hippointergetattributes',['hipPointerGetAttributes',['../group__Memory.html#ga3d68ba64959615d4ab84f10caa12433b',1,'hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr): hip_memory.cpp'],['../group__Memory.html#ga3d68ba64959615d4ab84f10caa12433b',1,'hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr): hip_memory.cpp']]], ['hipreadmodeelementtype',['hipReadModeElementType',['../hip__texture_8h.html#a442e950774f7306dc33692e358c92c94a829645801202174d052d667ffa4e1b8d',1,'hip_texture.h']]], - ['hipsetdevice',['hipSetDevice',['../group__Device.html#ga8ec0b093af0adadc7fe98bf33fa21620',1,'hipSetDevice(int device): hip_hcc.cpp'],['../group__Device.html#ga8ec0b093af0adadc7fe98bf33fa21620',1,'hipSetDevice(int device): hip_hcc.cpp'],['../group__Device.html#ga8ec0b093af0adadc7fe98bf33fa21620',1,'hipSetDevice(int device): hip_hcc2.cpp']]], + ['hipsetdevice',['hipSetDevice',['../group__Device.html#ga8ec0b093af0adadc7fe98bf33fa21620',1,'hipSetDevice(int device): hip_device.cpp'],['../group__Device.html#ga8ec0b093af0adadc7fe98bf33fa21620',1,'hipSetDevice(int device): hip_device.cpp']]], + ['hipsetdeviceflags',['hipSetDeviceFlags',['../group__Device.html#ga6e54db382768827e84725632018307aa',1,'hip_runtime_api.h']]], ['hipsharedmembanksizedefault',['hipSharedMemBankSizeDefault',['../group__GlobalDefs.html#gga2e17b71d94ac350f2ccd914fd49d104eaf5b325c9b7bde878913f768eaba5014d',1,'hip_runtime_api.h']]], ['hipsharedmembanksizeeightbyte',['hipSharedMemBankSizeEightByte',['../group__GlobalDefs.html#gga2e17b71d94ac350f2ccd914fd49d104ea64518b4f5a25f536c883330167e79258',1,'hip_runtime_api.h']]], ['hipsharedmembanksizefourbyte',['hipSharedMemBankSizeFourByte',['../group__GlobalDefs.html#gga2e17b71d94ac350f2ccd914fd49d104ea0a95a6e0c33106c42d66ab9476ff954a',1,'hip_runtime_api.h']]], ['hipsharedmemconfig',['hipSharedMemConfig',['../group__GlobalDefs.html#ga2e17b71d94ac350f2ccd914fd49d104e',1,'hipSharedMemConfig(): hip_runtime_api.h'],['../group__GlobalDefs.html#ga6b1ca424fa26a5fb718937d662eaee7f',1,'hipSharedMemConfig(): hip_runtime_api.h']]], - ['hipstreamcreatewithflags',['hipStreamCreateWithFlags',['../group__Stream.html#gaf2382e3cc6632332a8983a0f58e43494',1,'hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags): hip_hcc.cpp'],['../group__Stream.html#gaf2382e3cc6632332a8983a0f58e43494',1,'hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags): hip_hcc.cpp'],['../group__Stream.html#gaf2382e3cc6632332a8983a0f58e43494',1,'hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags): hip_hcc2.cpp']]], + ['hipstreamcreate',['hipStreamCreate',['../group__Stream.html#gaff5b62d6e9502d80879f7176f4d03102',1,'hipStreamCreate(hipStream_t *stream): hip_stream.cpp'],['../group__Stream.html#gaff5b62d6e9502d80879f7176f4d03102',1,'hipStreamCreate(hipStream_t *stream): hip_stream.cpp']]], + ['hipstreamcreatewithflags',['hipStreamCreateWithFlags',['../group__Stream.html#gaf2382e3cc6632332a8983a0f58e43494',1,'hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags): hip_stream.cpp'],['../group__Stream.html#gaf2382e3cc6632332a8983a0f58e43494',1,'hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags): hip_stream.cpp']]], ['hipstreamdefault',['hipStreamDefault',['../group__GlobalDefs.html#ga6df5f70eb976836ab3598cacf0ffcdf9',1,'hip_runtime_api.h']]], - ['hipstreamdestroy',['hipStreamDestroy',['../group__Stream.html#ga3076a3499ed2c7821311006100bb95ec',1,'hipStreamDestroy(hipStream_t stream): hip_hcc.cpp'],['../group__Stream.html#ga3076a3499ed2c7821311006100bb95ec',1,'hipStreamDestroy(hipStream_t stream): hip_hcc.cpp'],['../group__Stream.html#ga3076a3499ed2c7821311006100bb95ec',1,'hipStreamDestroy(hipStream_t stream): hip_hcc2.cpp']]], - ['hipstreamgetflags',['hipStreamGetFlags',['../group__Stream.html#ga3249555a26439591b8873f70b39bb116',1,'hipStreamGetFlags(hipStream_t stream, unsigned int *flags): hip_hcc.cpp'],['../group__Stream.html#ga3249555a26439591b8873f70b39bb116',1,'hipStreamGetFlags(hipStream_t stream, unsigned int *flags): hip_hcc.cpp'],['../group__Stream.html#ga3249555a26439591b8873f70b39bb116',1,'hipStreamGetFlags(hipStream_t stream, unsigned int *flags): hip_hcc2.cpp']]], + ['hipstreamdestroy',['hipStreamDestroy',['../group__Stream.html#ga3076a3499ed2c7821311006100bb95ec',1,'hipStreamDestroy(hipStream_t stream): hip_stream.cpp'],['../group__Stream.html#ga3076a3499ed2c7821311006100bb95ec',1,'hipStreamDestroy(hipStream_t stream): hip_stream.cpp']]], + ['hipstreamgetflags',['hipStreamGetFlags',['../group__Stream.html#ga3249555a26439591b8873f70b39bb116',1,'hipStreamGetFlags(hipStream_t stream, unsigned int *flags): hip_stream.cpp'],['../group__Stream.html#ga3249555a26439591b8873f70b39bb116',1,'hipStreamGetFlags(hipStream_t stream, unsigned int *flags): hip_stream.cpp']]], ['hipstreamnonblocking',['hipStreamNonBlocking',['../group__GlobalDefs.html#gaaba9ae995d9b43b7d1ee70c6fa12c57d',1,'hip_runtime_api.h']]], - ['hipstreamsynchronize',['hipStreamSynchronize',['../group__Stream.html#gabbfb9f573a6ebe8c478605ecb5504a74',1,'hipStreamSynchronize(hipStream_t stream): hip_hcc.cpp'],['../group__Stream.html#gabbfb9f573a6ebe8c478605ecb5504a74',1,'hipStreamSynchronize(hipStream_t stream): hip_hcc.cpp'],['../group__Stream.html#gabbfb9f573a6ebe8c478605ecb5504a74',1,'hipStreamSynchronize(hipStream_t stream): hip_hcc2.cpp']]], - ['hipstreamwaitevent',['hipStreamWaitEvent',['../group__Stream.html#gacdd84c8f8ef1539c96c57c1d5bcae633',1,'hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags): hip_hcc.cpp'],['../group__Stream.html#gacdd84c8f8ef1539c96c57c1d5bcae633',1,'hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags): hip_hcc.cpp'],['../group__Stream.html#gacdd84c8f8ef1539c96c57c1d5bcae633',1,'hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags): hip_hcc2.cpp']]], + ['hipstreamsynchronize',['hipStreamSynchronize',['../group__Stream.html#gabbfb9f573a6ebe8c478605ecb5504a74',1,'hipStreamSynchronize(hipStream_t stream): hip_stream.cpp'],['../group__Stream.html#gabbfb9f573a6ebe8c478605ecb5504a74',1,'hipStreamSynchronize(hipStream_t stream): hip_stream.cpp']]], + ['hipstreamwaitevent',['hipStreamWaitEvent',['../group__Stream.html#gacdd84c8f8ef1539c96c57c1d5bcae633',1,'hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags): hip_stream.cpp'],['../group__Stream.html#gacdd84c8f8ef1539c96c57c1d5bcae633',1,'hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags): hip_stream.cpp']]], ['hipsuccess',['hipSuccess',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594aadfbdb847b149723c684ebd764556063',1,'hip_runtime_api.h']]], ['hiptexturefiltermode',['hipTextureFilterMode',['../hip__texture_8h.html#aa2f0b6002b81d0a43a808cb880bb21e6',1,'hip_texture.h']]], ['hiptexturereadmode',['hipTextureReadMode',['../hip__texture_8h.html#a442e950774f7306dc33692e358c92c94',1,'hip_texture.h']]], diff --git a/docs/RuntimeAPI/html/search/all_9.js b/docs/RuntimeAPI/html/search/all_9.js index 9c19d12ead..ae0e44d79e 100644 --- a/docs/RuntimeAPI/html/search/all_9.js +++ b/docs/RuntimeAPI/html/search/all_9.js @@ -1,9 +1,13 @@ var searchData= [ - ['ihipdevice_5ft',['ihipDevice_t',['../structihipDevice__t.html',1,'']]], + ['ihipdevice_5ft',['ihipDevice_t',['../classihipDevice__t.html',1,'']]], + ['ihipdevicecriticalbase_5ft',['ihipDeviceCriticalBase_t',['../classihipDeviceCriticalBase__t.html',1,'']]], + ['ihipdevicecriticalbase_5ft_3c_20devicemutex_20_3e',['ihipDeviceCriticalBase_t< DeviceMutex >',['../classihipDeviceCriticalBase__t.html',1,'']]], ['ihipevent_5ft',['ihipEvent_t',['../structihipEvent__t.html',1,'']]], ['ihipexception',['ihipException',['../classihipException.html',1,'']]], ['ihipsignal_5ft',['ihipSignal_t',['../structihipSignal__t.html',1,'']]], ['ihipstream_5ft',['ihipStream_t',['../classihipStream__t.html',1,'']]], + ['ihipstreamcriticalbase_5ft',['ihipStreamCriticalBase_t',['../classihipStreamCriticalBase__t.html',1,'']]], + ['ihipstreamcriticalbase_5ft_3c_20streammutex_20_3e',['ihipStreamCriticalBase_t< StreamMutex >',['../classihipStreamCriticalBase__t.html',1,'']]], ['ismultigpuboard',['isMultiGpuBoard',['../structhipDeviceProp__t.html#a9bb19b2b0cdee8977ed63964532d639d',1,'hipDeviceProp_t']]] ]; diff --git a/docs/RuntimeAPI/html/search/all_a.js b/docs/RuntimeAPI/html/search/all_a.js index 41a7c59602..8cf55c56bd 100644 --- a/docs/RuntimeAPI/html/search/all_a.js +++ b/docs/RuntimeAPI/html/search/all_a.js @@ -1,4 +1,8 @@ var searchData= [ - ['l2cachesize',['l2CacheSize',['../structhipDeviceProp__t.html#a24404decccc16833973c803ced6f3a51',1,'hipDeviceProp_t']]] + ['l2cachesize',['l2CacheSize',['../structhipDeviceProp__t.html#a24404decccc16833973c803ced6f3a51',1,'hipDeviceProp_t']]], + ['lockedaccessor',['LockedAccessor',['../classLockedAccessor.html',1,'']]], + ['lockedbase',['LockedBase',['../structLockedBase.html',1,'']]], + ['lockedbase_3c_20devicemutex_20_3e',['LockedBase< DeviceMutex >',['../structLockedBase.html',1,'']]], + ['lockedbase_3c_20streammutex_20_3e',['LockedBase< StreamMutex >',['../structLockedBase.html',1,'']]] ]; diff --git a/docs/RuntimeAPI/html/search/classes_3.js b/docs/RuntimeAPI/html/search/classes_3.js index 7b99529bec..87ba8606aa 100644 --- a/docs/RuntimeAPI/html/search/classes_3.js +++ b/docs/RuntimeAPI/html/search/classes_3.js @@ -1,8 +1,12 @@ var searchData= [ - ['ihipdevice_5ft',['ihipDevice_t',['../structihipDevice__t.html',1,'']]], + ['ihipdevice_5ft',['ihipDevice_t',['../classihipDevice__t.html',1,'']]], + ['ihipdevicecriticalbase_5ft',['ihipDeviceCriticalBase_t',['../classihipDeviceCriticalBase__t.html',1,'']]], + ['ihipdevicecriticalbase_5ft_3c_20devicemutex_20_3e',['ihipDeviceCriticalBase_t< DeviceMutex >',['../classihipDeviceCriticalBase__t.html',1,'']]], ['ihipevent_5ft',['ihipEvent_t',['../structihipEvent__t.html',1,'']]], ['ihipexception',['ihipException',['../classihipException.html',1,'']]], ['ihipsignal_5ft',['ihipSignal_t',['../structihipSignal__t.html',1,'']]], - ['ihipstream_5ft',['ihipStream_t',['../classihipStream__t.html',1,'']]] + ['ihipstream_5ft',['ihipStream_t',['../classihipStream__t.html',1,'']]], + ['ihipstreamcriticalbase_5ft',['ihipStreamCriticalBase_t',['../classihipStreamCriticalBase__t.html',1,'']]], + ['ihipstreamcriticalbase_5ft_3c_20streammutex_20_3e',['ihipStreamCriticalBase_t< StreamMutex >',['../classihipStreamCriticalBase__t.html',1,'']]] ]; diff --git a/docs/RuntimeAPI/html/search/classes_4.js b/docs/RuntimeAPI/html/search/classes_4.js index 7708af376c..09019c00b4 100644 --- a/docs/RuntimeAPI/html/search/classes_4.js +++ b/docs/RuntimeAPI/html/search/classes_4.js @@ -1,4 +1,7 @@ var searchData= [ - ['stagingbuffer',['StagingBuffer',['../structStagingBuffer.html',1,'']]] + ['lockedaccessor',['LockedAccessor',['../classLockedAccessor.html',1,'']]], + ['lockedbase',['LockedBase',['../structLockedBase.html',1,'']]], + ['lockedbase_3c_20devicemutex_20_3e',['LockedBase< DeviceMutex >',['../structLockedBase.html',1,'']]], + ['lockedbase_3c_20streammutex_20_3e',['LockedBase< StreamMutex >',['../structLockedBase.html',1,'']]] ]; diff --git a/docs/RuntimeAPI/html/search/classes_5.js b/docs/RuntimeAPI/html/search/classes_5.js index 67b71f7499..7708af376c 100644 --- a/docs/RuntimeAPI/html/search/classes_5.js +++ b/docs/RuntimeAPI/html/search/classes_5.js @@ -1,5 +1,4 @@ var searchData= [ - ['texture',['texture',['../structtexture.html',1,'']]], - ['texturereference',['textureReference',['../structtextureReference.html',1,'']]] + ['stagingbuffer',['StagingBuffer',['../structStagingBuffer.html',1,'']]] ]; diff --git a/docs/RuntimeAPI/html/search/classes_6.js b/docs/RuntimeAPI/html/search/classes_6.js index e2e16672fb..8ced671759 100644 --- a/docs/RuntimeAPI/html/search/classes_6.js +++ b/docs/RuntimeAPI/html/search/classes_6.js @@ -1,4 +1,4 @@ var searchData= [ - ['short1',['short1',['../structshort1.html',1,'']]] + ['texturereference',['textureReference',['../structtextureReference.html',1,'']]] ]; diff --git a/docs/RuntimeAPI/html/search/classes_7.html b/docs/RuntimeAPI/html/search/classes_7.html deleted file mode 100644 index 9e5f5c9861..0000000000 --- a/docs/RuntimeAPI/html/search/classes_7.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - -
                  -
                  Loading...
                  -
                  - -
                  Searching...
                  -
                  No Matches
                  - -
                  - - diff --git a/docs/RuntimeAPI/html/search/classes_7.js b/docs/RuntimeAPI/html/search/classes_7.js deleted file mode 100644 index 67b71f7499..0000000000 --- a/docs/RuntimeAPI/html/search/classes_7.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['texture',['texture',['../structtexture.html',1,'']]], - ['texturereference',['textureReference',['../structtextureReference.html',1,'']]] -]; diff --git a/docs/RuntimeAPI/html/search/classes_8.js b/docs/RuntimeAPI/html/search/classes_8.js deleted file mode 100644 index cccf1a2ebc..0000000000 --- a/docs/RuntimeAPI/html/search/classes_8.js +++ /dev/null @@ -1,10 +0,0 @@ -var searchData= -[ - ['uchar1',['uchar1',['../structuchar1.html',1,'']]], - ['uint1',['uint1',['../structuint1.html',1,'']]], - ['ulong1',['ulong1',['../structulong1.html',1,'']]], - ['ulonglong1',['ulonglong1',['../structulonglong1.html',1,'']]], - ['ulonglong3',['ulonglong3',['../structulonglong3.html',1,'']]], - ['ulonglong4',['ulonglong4',['../structulonglong4.html',1,'']]], - ['ushort1',['ushort1',['../structushort1.html',1,'']]] -]; diff --git a/docs/RuntimeAPI/html/search/enumvalues_0.js b/docs/RuntimeAPI/html/search/enumvalues_0.js index 1b894e37b2..2c6c17cf36 100644 --- a/docs/RuntimeAPI/html/search/enumvalues_0.js +++ b/docs/RuntimeAPI/html/search/enumvalues_0.js @@ -36,6 +36,8 @@ var searchData= ['hiperrornodevice',['hipErrorNoDevice',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594ad4406972c318df36d231310a15131c24',1,'hip_runtime_api.h']]], ['hiperrornotready',['hipErrorNotReady',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594aa9638063c8746a9d1fda2b2069a0a9f1',1,'hip_runtime_api.h']]], ['hiperroroutofresources',['hipErrorOutOfResources',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a60c1c080b79bdde9ef5e808f974ac9ed',1,'hip_runtime_api.h']]], + ['hiperrorpeeraccessalreadyenabled',['hipErrorPeerAccessAlreadyEnabled',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a5399c146f91246f8b77abcd4ea30e7ac',1,'hip_runtime_api.h']]], + ['hiperrorpeeraccessnotenabled',['hipErrorPeerAccessNotEnabled',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a2ee0bf2e64840f253e4a1b12bbaf2d09',1,'hip_runtime_api.h']]], ['hiperrorruntimememory',['hipErrorRuntimeMemory',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a1159eb9a6be66bea740a8bfb61378723',1,'hip_runtime_api.h']]], ['hiperrorruntimeother',['hipErrorRuntimeOther',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594a44f847c5914be2177feac107dcb096d1',1,'hip_runtime_api.h']]], ['hiperrortbd',['hipErrorTbd',['../group__GlobalDefs.html#ggadf5010f6e140a53ecbdf949e73e87594ab556409e11ddb0c4cf77a2f4fc91ea9e',1,'hip_runtime_api.h']]], diff --git a/docs/RuntimeAPI/html/search/functions_0.js b/docs/RuntimeAPI/html/search/functions_0.js index b4ccd7edbb..fc5d49f443 100644 --- a/docs/RuntimeAPI/html/search/functions_0.js +++ b/docs/RuntimeAPI/html/search/functions_0.js @@ -1,4 +1,58 @@ var searchData= [ - ['getproperties',['getProperties',['../structihipDevice__t.html#a0abb382f1bcdda80028f9a8307e50561',1,'ihipDevice_t']]] + ['hipdevicecanaccesspeer',['hipDeviceCanAccessPeer',['../group__PeerToPeer.html#ga0a1c9ccd775758d9d7d5b5a1f525b719',1,'hipDeviceCanAccessPeer(int *canAccessPeer, int deviceId, int peerDeviceId): hip_peer.cpp'],['../group__PeerToPeer.html#ga0a1c9ccd775758d9d7d5b5a1f525b719',1,'hipDeviceCanAccessPeer(int *canAccessPeer, int deviceId, int peerDeviceId): hip_peer.cpp']]], + ['hipdevicedisablepeeraccess',['hipDeviceDisablePeerAccess',['../group__PeerToPeer.html#ga85030c72824fb60aaddc7374ab60481b',1,'hipDeviceDisablePeerAccess(int peerDeviceId): hip_peer.cpp'],['../group__PeerToPeer.html#ga85030c72824fb60aaddc7374ab60481b',1,'hipDeviceDisablePeerAccess(int peerDeviceId): hip_peer.cpp']]], + ['hipdeviceenablepeeraccess',['hipDeviceEnablePeerAccess',['../group__PeerToPeer.html#ga0caca59034134d7a7bb893cc1caa653e',1,'hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags): hip_peer.cpp'],['../group__PeerToPeer.html#ga0caca59034134d7a7bb893cc1caa653e',1,'hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags): hip_peer.cpp']]], + ['hipdevicegetattribute',['hipDeviceGetAttribute',['../group__Device.html#gac49518ff2b26b98ea2ec9e9268761a24',1,'hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device): hip_device.cpp'],['../group__Device.html#gac49518ff2b26b98ea2ec9e9268761a24',1,'hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device): hip_device.cpp']]], + ['hipdevicegetcacheconfig',['hipDeviceGetCacheConfig',['../group__Device.html#gaeeffa2456c5430400bea75ecd6ad1e68',1,'hipDeviceGetCacheConfig(hipFuncCache *cacheConfig): hip_device.cpp'],['../group__Device.html#gaeeffa2456c5430400bea75ecd6ad1e68',1,'hipDeviceGetCacheConfig(hipFuncCache *cacheConfig): hip_device.cpp']]], + ['hipdevicegetsharedmemconfig',['hipDeviceGetSharedMemConfig',['../group__Device.html#ga1bb08f774a34a468d969a8a04791c9bb',1,'hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig): hip_device.cpp'],['../group__Device.html#ga1bb08f774a34a468d969a8a04791c9bb',1,'hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig): hip_device.cpp']]], + ['hipdevicereset',['hipDeviceReset',['../group__Device.html#ga8d57161ae56a8edc46eeda447417bf6c',1,'hipDeviceReset(void): hip_device.cpp'],['../group__Device.html#ga8d57161ae56a8edc46eeda447417bf6c',1,'hipDeviceReset(void): hip_device.cpp']]], + ['hipdevicesetcacheconfig',['hipDeviceSetCacheConfig',['../group__Device.html#gac2b282179f29c4c0ca7b5391242c6a4c',1,'hipDeviceSetCacheConfig(hipFuncCache cacheConfig): hip_device.cpp'],['../group__Device.html#gac2b282179f29c4c0ca7b5391242c6a4c',1,'hipDeviceSetCacheConfig(hipFuncCache cacheConfig): hip_device.cpp']]], + ['hipdevicesetsharedmemconfig',['hipDeviceSetSharedMemConfig',['../group__Device.html#ga9b1f279084e76691cedfbfadf9c717ee',1,'hipDeviceSetSharedMemConfig(hipSharedMemConfig config): hip_device.cpp'],['../group__Device.html#ga9b1f279084e76691cedfbfadf9c717ee',1,'hipDeviceSetSharedMemConfig(hipSharedMemConfig config): hip_device.cpp']]], + ['hipdevicesynchronize',['hipDeviceSynchronize',['../group__Device.html#gaefdc2847fb1d6c3fb1354e827a191ebd',1,'hipDeviceSynchronize(void): hip_device.cpp'],['../group__Device.html#gaefdc2847fb1d6c3fb1354e827a191ebd',1,'hipDeviceSynchronize(void): hip_device.cpp']]], + ['hipdrivergetversion',['hipDriverGetVersion',['../group__Version.html#gaf6c342f52d2a29a0aca5cdd89b4dd47c',1,'hipDriverGetVersion(int *driverVersion): hip_peer.cpp'],['../group__Version.html#gaf6c342f52d2a29a0aca5cdd89b4dd47c',1,'hipDriverGetVersion(int *driverVersion): hip_peer.cpp']]], + ['hipeventcreate',['hipEventCreate',['../group__Event.html#ga5df2309c9f29ca4c8e669db658d411b4',1,'hipEventCreate(hipEvent_t *event): hip_event.cpp'],['../group__Event.html#ga5df2309c9f29ca4c8e669db658d411b4',1,'hipEventCreate(hipEvent_t *event): hip_event.cpp']]], + ['hipeventcreatewithflags',['hipEventCreateWithFlags',['../group__Event.html#gae86a5acb1b22b61bc9ecb9c28fc71b75',1,'hipEventCreateWithFlags(hipEvent_t *event, unsigned flags): hip_event.cpp'],['../group__Event.html#gae86a5acb1b22b61bc9ecb9c28fc71b75',1,'hipEventCreateWithFlags(hipEvent_t *event, unsigned flags): hip_event.cpp']]], + ['hipeventdestroy',['hipEventDestroy',['../group__Event.html#ga83260357dce0c39e8c6a3c74ec97484c',1,'hipEventDestroy(hipEvent_t event): hip_event.cpp'],['../group__Event.html#ga83260357dce0c39e8c6a3c74ec97484c',1,'hipEventDestroy(hipEvent_t event): hip_event.cpp']]], + ['hipeventelapsedtime',['hipEventElapsedTime',['../group__Event.html#gad4128b815cb475c8e13c7e66ff6250b7',1,'hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop): hip_event.cpp'],['../group__Event.html#gad4128b815cb475c8e13c7e66ff6250b7',1,'hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop): hip_event.cpp']]], + ['hipeventquery',['hipEventQuery',['../group__Event.html#ga5d12d7b798b5ceb5932d1ac21f5ac776',1,'hipEventQuery(hipEvent_t event): hip_event.cpp'],['../group__Event.html#ga5d12d7b798b5ceb5932d1ac21f5ac776',1,'hipEventQuery(hipEvent_t event): hip_event.cpp']]], + ['hipeventrecord',['hipEventRecord',['../group__Event.html#ga553b6f7a8e7b7dd9536d8a64c24d7e29',1,'hipEventRecord(hipEvent_t event, hipStream_t stream): hip_event.cpp'],['../group__Event.html#ga553b6f7a8e7b7dd9536d8a64c24d7e29',1,'hipEventRecord(hipEvent_t event, hipStream_t stream): hip_event.cpp']]], + ['hipeventsynchronize',['hipEventSynchronize',['../group__Event.html#ga1f72d98ba5d6f7dc3da54e0c41fe38b1',1,'hipEventSynchronize(hipEvent_t event): hip_event.cpp'],['../group__Event.html#ga1f72d98ba5d6f7dc3da54e0c41fe38b1',1,'hipEventSynchronize(hipEvent_t event): hip_event.cpp']]], + ['hipfree',['hipFree',['../group__Memory.html#ga740d08da65cae1441ba32f8fedb863d1',1,'hipFree(void *ptr): hip_memory.cpp'],['../group__Memory.html#ga740d08da65cae1441ba32f8fedb863d1',1,'hipFree(void *ptr): hip_memory.cpp']]], + ['hipfreehost',['hipFreeHost',['../group__Memory.html#gad2164cc3d49da53052f4b83b789e90c9',1,'hipFreeHost(void *ptr) __attribute__((deprecated("use hipHostFree instead"))): hip_memory.cpp'],['../group__Memory.html#gad2164cc3d49da53052f4b83b789e90c9',1,'hipFreeHost(void *ptr): hip_memory.cpp']]], + ['hipfuncsetcacheconfig',['hipFuncSetCacheConfig',['../group__Device.html#gadd94a910c2b840833cc325b1e5425702',1,'hipFuncSetCacheConfig(hipFuncCache config): hip_device.cpp'],['../group__Device.html#gadd94a910c2b840833cc325b1e5425702',1,'hipFuncSetCacheConfig(hipFuncCache cacheConfig): hip_device.cpp']]], + ['hipgetdevice',['hipGetDevice',['../group__Device.html#gaffc83567f2df3bbe2d37a19872d60f24',1,'hipGetDevice(int *device): hip_device.cpp'],['../group__Device.html#gaffc83567f2df3bbe2d37a19872d60f24',1,'hipGetDevice(int *device): hip_device.cpp']]], + ['hipgetdevicecount',['hipGetDeviceCount',['../group__Device.html#ga8555d5c76d88c50ddbf54ae70b568394',1,'hipGetDeviceCount(int *count): hip_device.cpp'],['../group__Device.html#ga8555d5c76d88c50ddbf54ae70b568394',1,'hipGetDeviceCount(int *count): hip_device.cpp']]], + ['hipgetdeviceproperties',['hipGetDeviceProperties',['../group__Device.html#ga77c20744e2a88c31440992d6c7754b5f',1,'hipGetDeviceProperties(hipDeviceProp_t *prop, int device): hip_device.cpp'],['../group__Device.html#ga77c20744e2a88c31440992d6c7754b5f',1,'hipGetDeviceProperties(hipDeviceProp_t *props, int device): hip_device.cpp']]], + ['hipgeterrorname',['hipGetErrorName',['../group__Error.html#ga88c474d77635523dbf6ca67be7b56999',1,'hipGetErrorName(hipError_t hip_error): hip_error.cpp'],['../group__Error.html#ga88c474d77635523dbf6ca67be7b56999',1,'hipGetErrorName(hipError_t hip_error): hip_error.cpp']]], + ['hipgeterrorstring',['hipGetErrorString',['../group__Error.html#ga5959779a654bbc98ffe6d36ab536740a',1,'hipGetErrorString(hipError_t hip_error): hip_error.cpp'],['../group__Error.html#ga5959779a654bbc98ffe6d36ab536740a',1,'hipGetErrorString(hipError_t hip_error): hip_error.cpp']]], + ['hipgetlasterror',['hipGetLastError',['../group__Error.html#ga533daeb9114d7fc2db8d867adf9e419b',1,'hipGetLastError(void): hip_error.cpp'],['../group__Error.html#ga533daeb9114d7fc2db8d867adf9e419b',1,'hipGetLastError(): hip_error.cpp']]], + ['hiphccgetaccelerator',['hipHccGetAccelerator',['../hip__hcc_8cpp.html#a0d24b3157fd1b16d38672bb157ec4cd4',1,'hip_hcc.cpp']]], + ['hiphccgetacceleratorview',['hipHccGetAcceleratorView',['../hip__hcc_8cpp.html#a1a7087ea9c3c3323270d7cce73650b44',1,'hip_hcc.cpp']]], + ['hiphostfree',['hipHostFree',['../group__Memory.html#ga2e543f58ee4544e317cd695d6d82e0a3',1,'hipHostFree(void *ptr): hip_memory.cpp'],['../group__Memory.html#ga2e543f58ee4544e317cd695d6d82e0a3',1,'hipHostFree(void *ptr): hip_memory.cpp']]], + ['hiphostgetdevicepointer',['hipHostGetDevicePointer',['../group__Memory.html#ga8fa7a0478020b835a24785cd6bb89725',1,'hip_runtime_api.h']]], + ['hiphostgetflags',['hipHostGetFlags',['../group__Memory.html#ga4d26915873b3e3534ceb4dc310f8709a',1,'hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr): hip_memory.cpp'],['../group__Memory.html#ga4d26915873b3e3534ceb4dc310f8709a',1,'hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr): hip_memory.cpp']]], + ['hiphostmalloc',['hipHostMalloc',['../group__Memory.html#gaad40bc7d97ccc799403ef5a9a8c246e1',1,'hipHostMalloc(void **ptr, size_t size, unsigned int flags): hip_memory.cpp'],['../group__Memory.html#gaad40bc7d97ccc799403ef5a9a8c246e1',1,'hipHostMalloc(void **ptr, size_t sizeBytes, unsigned int flags): hip_memory.cpp']]], + ['hiphostregister',['hipHostRegister',['../group__Memory.html#gab8258f051e1a1f7385f794a15300e674',1,'hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags): hip_memory.cpp'],['../group__Memory.html#gab8258f051e1a1f7385f794a15300e674',1,'hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags): hip_memory.cpp']]], + ['hiphostunregister',['hipHostUnregister',['../group__Memory.html#ga4c9e1810b9f5858d36c4d28c91c86924',1,'hipHostUnregister(void *hostPtr): hip_memory.cpp'],['../group__Memory.html#ga4c9e1810b9f5858d36c4d28c91c86924',1,'hipHostUnregister(void *hostPtr): hip_memory.cpp']]], + ['hipmalloc',['hipMalloc',['../group__Memory.html#ga4c6fcfe80010069d2792780d00dcead2',1,'hipMalloc(void **ptr, size_t size): hip_memory.cpp'],['../group__Memory.html#ga4c6fcfe80010069d2792780d00dcead2',1,'hipMalloc(void **ptr, size_t sizeBytes): hip_memory.cpp']]], + ['hipmallochost',['hipMallocHost',['../group__Memory.html#gad3d3cdf82eb0058fc9eac1f939cd9d30',1,'hipMallocHost(void **ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead"))): hip_memory.cpp'],['../group__Memory.html#gad3d3cdf82eb0058fc9eac1f939cd9d30',1,'hipMallocHost(void **ptr, size_t sizeBytes): hip_memory.cpp']]], + ['hipmemcpy',['hipMemcpy',['../group__Memory.html#gac1a055d288302edd641c6d7416858e1e',1,'hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind): hip_memory.cpp'],['../group__Memory.html#gac1a055d288302edd641c6d7416858e1e',1,'hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind): hip_memory.cpp']]], + ['hipmemcpyasync',['hipMemcpyAsync',['../group__Memory.html#gad55fa9f5980b711bc93c52820149ba18',1,'hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream): hip_memory.cpp'],['../group__Memory.html#gad55fa9f5980b711bc93c52820149ba18',1,'hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream): hip_memory.cpp']]], + ['hipmemcpypeer',['hipMemcpyPeer',['../group__PeerToPeer.html#ga5512f45e25c08052667c8ffe7162333b',1,'hipMemcpyPeer(void *dst, int dstDeviceId, const void *src, int srcDeviceId, size_t sizeBytes): hip_peer.cpp'],['../group__PeerToPeer.html#ga5512f45e25c08052667c8ffe7162333b',1,'hipMemcpyPeer(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes): hip_peer.cpp']]], + ['hipmemcpypeerasync',['hipMemcpyPeerAsync',['../group__PeerToPeer.html#ga216f951370c931d22e80c089ab724ed9',1,'hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream): hip_peer.cpp'],['../group__PeerToPeer.html#ga216f951370c931d22e80c089ab724ed9',1,'hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream): hip_peer.cpp']]], + ['hipmemcpytosymbol',['hipMemcpyToSymbol',['../group__Memory.html#ga131ac5c1ba04e186112491cb9bf964bc',1,'hipMemcpyToSymbol(const char *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind): hip_memory.cpp'],['../group__Memory.html#ga131ac5c1ba04e186112491cb9bf964bc',1,'hipMemcpyToSymbol(const char *symbolName, const void *src, size_t count, size_t offset, hipMemcpyKind kind): hip_memory.cpp']]], + ['hipmemgetinfo',['hipMemGetInfo',['../group__Memory.html#ga311c3e246a21590de14478b8bd063be2',1,'hipMemGetInfo(size_t *free, size_t *total): hip_memory.cpp'],['../group__Memory.html#ga311c3e246a21590de14478b8bd063be2',1,'hipMemGetInfo(size_t *free, size_t *total): hip_memory.cpp']]], + ['hipmemset',['hipMemset',['../group__Memory.html#gac7441e74affcce4b8b69dba996c5ebc4',1,'hipMemset(void *dst, int value, size_t sizeBytes): hip_memory.cpp'],['../group__Memory.html#gac7441e74affcce4b8b69dba996c5ebc4',1,'hipMemset(void *dst, int value, size_t sizeBytes): hip_memory.cpp']]], + ['hipmemsetasync',['hipMemsetAsync',['../group__Memory.html#gae7d90e14c387e49f10db597f12915c54',1,'hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t stream): hip_memory.cpp'],['../group__Memory.html#gae7d90e14c387e49f10db597f12915c54',1,'hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t stream): hip_memory.cpp']]], + ['hippeekatlasterror',['hipPeekAtLastError',['../group__Error.html#ga1dd660bc739f7e13edd34615660f0148',1,'hip_runtime_api.h']]], + ['hippointergetattributes',['hipPointerGetAttributes',['../group__Memory.html#ga3d68ba64959615d4ab84f10caa12433b',1,'hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr): hip_memory.cpp'],['../group__Memory.html#ga3d68ba64959615d4ab84f10caa12433b',1,'hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr): hip_memory.cpp']]], + ['hipsetdevice',['hipSetDevice',['../group__Device.html#ga8ec0b093af0adadc7fe98bf33fa21620',1,'hipSetDevice(int device): hip_device.cpp'],['../group__Device.html#ga8ec0b093af0adadc7fe98bf33fa21620',1,'hipSetDevice(int device): hip_device.cpp']]], + ['hipsetdeviceflags',['hipSetDeviceFlags',['../group__Device.html#ga6e54db382768827e84725632018307aa',1,'hip_runtime_api.h']]], + ['hipstreamcreate',['hipStreamCreate',['../group__Stream.html#gaff5b62d6e9502d80879f7176f4d03102',1,'hipStreamCreate(hipStream_t *stream): hip_stream.cpp'],['../group__Stream.html#gaff5b62d6e9502d80879f7176f4d03102',1,'hipStreamCreate(hipStream_t *stream): hip_stream.cpp']]], + ['hipstreamcreatewithflags',['hipStreamCreateWithFlags',['../group__Stream.html#gaf2382e3cc6632332a8983a0f58e43494',1,'hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags): hip_stream.cpp'],['../group__Stream.html#gaf2382e3cc6632332a8983a0f58e43494',1,'hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags): hip_stream.cpp']]], + ['hipstreamdestroy',['hipStreamDestroy',['../group__Stream.html#ga3076a3499ed2c7821311006100bb95ec',1,'hipStreamDestroy(hipStream_t stream): hip_stream.cpp'],['../group__Stream.html#ga3076a3499ed2c7821311006100bb95ec',1,'hipStreamDestroy(hipStream_t stream): hip_stream.cpp']]], + ['hipstreamgetflags',['hipStreamGetFlags',['../group__Stream.html#ga3249555a26439591b8873f70b39bb116',1,'hipStreamGetFlags(hipStream_t stream, unsigned int *flags): hip_stream.cpp'],['../group__Stream.html#ga3249555a26439591b8873f70b39bb116',1,'hipStreamGetFlags(hipStream_t stream, unsigned int *flags): hip_stream.cpp']]], + ['hipstreamsynchronize',['hipStreamSynchronize',['../group__Stream.html#gabbfb9f573a6ebe8c478605ecb5504a74',1,'hipStreamSynchronize(hipStream_t stream): hip_stream.cpp'],['../group__Stream.html#gabbfb9f573a6ebe8c478605ecb5504a74',1,'hipStreamSynchronize(hipStream_t stream): hip_stream.cpp']]], + ['hipstreamwaitevent',['hipStreamWaitEvent',['../group__Stream.html#gacdd84c8f8ef1539c96c57c1d5bcae633',1,'hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags): hip_stream.cpp'],['../group__Stream.html#gacdd84c8f8ef1539c96c57c1d5bcae633',1,'hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags): hip_stream.cpp']]] ]; diff --git a/docs/RuntimeAPI/html/search/groups_8.js b/docs/RuntimeAPI/html/search/groups_8.js deleted file mode 100644 index dec0aef6b9..0000000000 --- a/docs/RuntimeAPI/html/search/groups_8.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['texture_20reference_20management',['Texture Reference Management',['../group__Texture.html',1,'']]] -]; diff --git a/docs/RuntimeAPI/html/search/search.js b/docs/RuntimeAPI/html/search/search.js index 5f9ca1ea88..19b5f78809 100644 --- a/docs/RuntimeAPI/html/search/search.js +++ b/docs/RuntimeAPI/html/search/search.js @@ -8,9 +8,9 @@ var indexSectionsWithContent = { 0: "_abcdefghilmnoprstwxyz", - 1: "dfhist", + 1: "dfhilst", 2: "h", - 3: "gh", + 3: "h", 4: "achilmnprstwxyz", 5: "dh", 6: "h", diff --git a/docs/RuntimeAPI/html/search/typedefs_1.js b/docs/RuntimeAPI/html/search/typedefs_1.js index dc1a96aca6..d1f66c753c 100644 --- a/docs/RuntimeAPI/html/search/typedefs_1.js +++ b/docs/RuntimeAPI/html/search/typedefs_1.js @@ -1,5 +1,6 @@ var searchData= [ ['hipfunccache',['hipFuncCache',['../group__GlobalDefs.html#gaad15dc7939a0a25b16e4aa161fb41eee',1,'hip_runtime_api.h']]], + ['hipmemcpykind',['hipMemcpyKind',['../group__GlobalDefs.html#ga0c04e67413ce030817361f02673e5c85',1,'hip_runtime_api.h']]], ['hipsharedmemconfig',['hipSharedMemConfig',['../group__GlobalDefs.html#ga6b1ca424fa26a5fb718937d662eaee7f',1,'hip_runtime_api.h']]] ]; diff --git a/docs/RuntimeAPI/html/search/variables_2.js b/docs/RuntimeAPI/html/search/variables_2.js index e10fe26cff..0fba3440bc 100644 --- a/docs/RuntimeAPI/html/search/variables_2.js +++ b/docs/RuntimeAPI/html/search/variables_2.js @@ -16,8 +16,5 @@ var searchData= ['hasthreadfencesystem',['hasThreadFenceSystem',['../structhipDeviceArch__t.html#ac2818e3b91cba8beb36741e9867bb887',1,'hipDeviceArch_t']]], ['haswarpballot',['hasWarpBallot',['../structhipDeviceArch__t.html#af1e934a8a5106995bcc256287585564c',1,'hipDeviceArch_t']]], ['haswarpshuffle',['hasWarpShuffle',['../structhipDeviceArch__t.html#a3d922e8fc97ca1e8ecc39600b138fa2d',1,'hipDeviceArch_t']]], - ['haswarpvote',['hasWarpVote',['../structhipDeviceArch__t.html#a35bde017352eca1d4e0eceb3bf79f274',1,'hipDeviceArch_t']]], - ['hip_5flaunch_5fblocking',['HIP_LAUNCH_BLOCKING',['../group__HIP-ENV.html#ga8049b329f2663b4572d81e7a9aa8a155',1,'HIP_LAUNCH_BLOCKING(): hip_hcc.cpp'],['../group__HIP-ENV.html#ga8049b329f2663b4572d81e7a9aa8a155',1,'HIP_LAUNCH_BLOCKING(): hip_hcc.cpp'],['../group__HIP-ENV.html#ga8049b329f2663b4572d81e7a9aa8a155',1,'HIP_LAUNCH_BLOCKING(): hip_hcc2.cpp']]], - ['hip_5fprint_5fenv',['HIP_PRINT_ENV',['../group__HIP-ENV.html#ga1e1c85dbb250f1acfb484c1be1f3b28a',1,'HIP_PRINT_ENV(): hip_hcc.cpp'],['../group__HIP-ENV.html#ga1e1c85dbb250f1acfb484c1be1f3b28a',1,'HIP_PRINT_ENV(): hip_hcc.cpp'],['../group__HIP-ENV.html#ga1e1c85dbb250f1acfb484c1be1f3b28a',1,'HIP_PRINT_ENV(): hip_hcc2.cpp']]], - ['hip_5ftrace_5fapi',['HIP_TRACE_API',['../group__HIP-ENV.html#gaae9c541f3e25b8f002762337a03fec28',1,'HIP_TRACE_API(): hip_hcc.cpp'],['../group__HIP-ENV.html#gaae9c541f3e25b8f002762337a03fec28',1,'HIP_TRACE_API(): hip_hcc.cpp'],['../group__HIP-ENV.html#gaae9c541f3e25b8f002762337a03fec28',1,'HIP_TRACE_API(): hip_hcc2.cpp']]] + ['haswarpvote',['hasWarpVote',['../structhipDeviceArch__t.html#a35bde017352eca1d4e0eceb3bf79f274',1,'hipDeviceArch_t']]] ]; diff --git a/docs/RuntimeAPI/html/search/classes_8.html b/docs/RuntimeAPI/html/search/variables_e.html similarity index 93% rename from docs/RuntimeAPI/html/search/classes_8.html rename to docs/RuntimeAPI/html/search/variables_e.html index 82c35b32ef..1165006622 100644 --- a/docs/RuntimeAPI/html/search/classes_8.html +++ b/docs/RuntimeAPI/html/search/variables_e.html @@ -3,7 +3,7 @@ - + diff --git a/docs/RuntimeAPI/html/search/variables_e.js b/docs/RuntimeAPI/html/search/variables_e.js new file mode 100644 index 0000000000..e8bf38b99c --- /dev/null +++ b/docs/RuntimeAPI/html/search/variables_e.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['z',['z',['../structdim3.html#a866e38993ecc4e76fd47311236c16b04',1,'dim3']]] +]; diff --git a/docs/RuntimeAPI/html/staging__buffer_8h_source.html b/docs/RuntimeAPI/html/staging__buffer_8h_source.html new file mode 100644 index 0000000000..d828c08e98 --- /dev/null +++ b/docs/RuntimeAPI/html/staging__buffer_8h_source.html @@ -0,0 +1,165 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/staging_buffer.h Source File + + + + + + + + + +
                  +
                  + + + + + + +
                  +
                  HIP: Heterogenous-computing Interface for Portability +
                  +
                  +
                  + + + + + + + + + +
                  + +
                  + + +
                  +
                  +
                  +
                  staging_buffer.h
                  +
                  +
                  +
                  1 /*
                  +
                  2 Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
                  +
                  3 Permission is hereby granted, free of charge, to any person obtaining a copy
                  +
                  4 of this software and associated documentation files (the "Software"), to deal
                  +
                  5 in the Software without restriction, including without limitation the rights
                  +
                  6 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                  +
                  7 copies of the Software, and to permit persons to whom the Software is
                  +
                  8 furnished to do so, subject to the following conditions:
                  +
                  9 The above copyright notice and this permission notice shall be included in
                  +
                  10 all copies or substantial portions of the Software.
                  +
                  11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR
                  +
                  12 IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                  +
                  13 FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
                  +
                  14 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER
                  +
                  15 LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                  +
                  16 OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
                  +
                  17 THE SOFTWARE.
                  +
                  18 */
                  +
                  19 
                  +
                  20 //#pragma once
                  +
                  21 #ifndef STAGING_BUFFER_H
                  +
                  22 #define STAGING_BUFFER_H
                  +
                  23 
                  +
                  24 #include "hsa.h"
                  +
                  25 
                  +
                  26 
                  +
                  27 //-------------------------------------------------------------------------------------------------
                  +
                  28 // An optimized "staging buffer" used to implement Host-To-Device and Device-To-Host copies.
                  +
                  29 // Some GPUs may not be able to directly access host memory, and in these cases we need to
                  +
                  30 // stage the copy through a pinned staging buffer. For example, the CopyHostToDevice
                  +
                  31 // uses the CPU to copy to a pinned "staging buffer", and then use the GPU DMA engine to copy
                  +
                  32 // from the staging buffer to the final destination. The copy is broken into buffer-sized chunks
                  +
                  33 // to limit the size of the buffer and also to provide better performance by overlapping the CPU copies
                  +
                  34 // with the DMA copies.
                  +
                  35 //
                  +
                  36 // PinInPlace is another algorithm which pins the host memory "in-place", and copies it with the DMA
                  +
                  37 // engine. This routine is under development.
                  +
                  38 //
                  +
                  39 // Staging buffer provides thread-safe access via a mutex.
                  +
                  40 struct StagingBuffer {
                  +
                  41 
                  +
                  42  static const int _max_buffers = 4;
                  +
                  43 
                  +
                  44  StagingBuffer(hsa_agent_t hsaAgent, hsa_region_t systemRegion, size_t bufferSize, int numBuffers) ;
                  +
                  45  ~StagingBuffer();
                  +
                  46 
                  +
                  47  void CopyHostToDevice(void* dst, const void* src, size_t sizeBytes, hsa_signal_t *waitFor);
                  +
                  48  void CopyHostToDevicePinInPlace(void* dst, const void* src, size_t sizeBytes, hsa_signal_t *waitFor);
                  +
                  49 
                  +
                  50  void CopyDeviceToHost (void* dst, const void* src, size_t sizeBytes, hsa_signal_t *waitFor);
                  +
                  51  void CopyDeviceToHostPinInPlace(void* dst, const void* src, size_t sizeBytes, hsa_signal_t *waitFor);
                  +
                  52 
                  +
                  53 
                  +
                  54 private:
                  +
                  55  hsa_agent_t _hsa_agent;
                  +
                  56  size_t _bufferSize; // Size of the buffers.
                  +
                  57  int _numBuffers;
                  +
                  58 
                  +
                  59  char *_pinnedStagingBuffer[_max_buffers];
                  +
                  60  hsa_signal_t _completion_signal[_max_buffers];
                  +
                  61  std::mutex _copy_lock; // provide thread-safe access
                  +
                  62 };
                  +
                  63 
                  +
                  64 #endif
                  +
                  Definition: staging_buffer.h:40
                  +
                  + + + + diff --git a/docs/RuntimeAPI/html/structchar1-members.html b/docs/RuntimeAPI/html/structLockedBase-members.html similarity index 71% rename from docs/RuntimeAPI/html/structchar1-members.html rename to docs/RuntimeAPI/html/structLockedBase-members.html index b618c69432..f61745aef7 100644 --- a/docs/RuntimeAPI/html/structchar1-members.html +++ b/docs/RuntimeAPI/html/structLockedBase-members.html @@ -72,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Enumerations Enumerator Macros Groups Pages + All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
                  @@ -84,17 +84,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  -
                  char1 Member List
                  +
                  LockedBase< MUTEX_TYPE > Member List
                  -

                  This is the complete list of members for char1, including all inherited members.

                  +

                  This is the complete list of members for LockedBase< MUTEX_TYPE >, including all inherited members.

                  - + + +
                  x (defined in char1)char1
                  _mutex (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >
                  lock() (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >inline
                  unlock() (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >inline
                  diff --git a/docs/RuntimeAPI/html/structtexture.html b/docs/RuntimeAPI/html/structLockedBase.html similarity index 66% rename from docs/RuntimeAPI/html/structtexture.html rename to docs/RuntimeAPI/html/structLockedBase.html index a904f4e7d8..989ab46e91 100644 --- a/docs/RuntimeAPI/html/structtexture.html +++ b/docs/RuntimeAPI/html/structLockedBase.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: texture< T, texType, hipTextureReadMode > Struct Template Reference +HIP: Heterogenous-computing Interface for Portability: LockedBase< MUTEX_TYPE > Struct Template Reference @@ -84,45 +84,46 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  -
                  texture< T, texType, hipTextureReadMode > Struct Template Reference
                  +
                  LockedBase< MUTEX_TYPE > Struct Template Reference
                  -Inheritance diagram for texture< T, texType, hipTextureReadMode >:
                  +Inheritance diagram for LockedBase< MUTEX_TYPE >:
                  - - -textureReference + + +ihipDeviceCriticalBase_t< MUTEX_TYPE > +ihipStreamCriticalBase_t< MUTEX_TYPE >
                  + + + + + +

                  +Public Member Functions

                  +void lock ()
                   
                  +void unlock ()
                   
                  - - - - - - - - - + +

                  Public Attributes

                  -const T * _dataPtr
                   
                  - Public Attributes inherited from textureReference
                  -hipTextureFilterMode filterMode
                   
                  -bool normalized
                   
                  -hipChannelFormatDesc channelDesc
                   
                  +MUTEX_TYPE _mutex
                   

                  The documentation for this struct was generated from the following file:
                    -
                  • /home/bensander/HIP-privatestaging/include/hcc_detail/hip_texture.h
                  • +
                  • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                  diff --git a/docs/RuntimeAPI/html/structLockedBase.png b/docs/RuntimeAPI/html/structLockedBase.png new file mode 100644 index 0000000000000000000000000000000000000000..9677c74a19104743508958b80c33a8346628c6b0 GIT binary patch literal 1178 zcmeAS@N?(olHy`uVBq!ia0y~yU;?oNIGBN?|J1ejfs{mmPl)UP|Nnu^7jM3n_8*!6 zWP$O40|!_;@5lqW93?@1!3;n}AaM0mh!Fz=i>9ZGV@L(#+qrM2ZL;BUHGjEz&wuZ_ z&|ed$C>b5rdHVFsE6J@bm*(Y6+Rrfmx{2@QsjLcTH5g*TogCv{{9tf&Vsw}!4rS+8 z8}h{X+*4n6T>e0t*O|xDetxce{`cOWiOR2{z83voBE-KT*y*8vU`6rGIeTV(ei#2! zD6DAu-Q4{rmIwS`<@)*e^!sGL@R{5iTW)@P%pvk>O8|p~Pj%o22Al4x8J{alH`}cg z?JRoFEmCwwPvl!E*TMo0uD8AYJIi~mP5$f*D#?^vbYa?yZQXlV~|~P~*(Z z57WJXZjlk16w-C-->L^crRF`X1xh7q{3yG(@Ih76=~@1t)wuFL%4)38Vt8|1KVU^> ziTyN<7J>O1*FW~VB=U1OJxtfwa%@ihu8?Uv|154zvB~oI{$y3rPSZJ2Ub~hVIW4pk zN|@f#wCBP{#-?)*j{dp!|D<0lgxkW@prQ|zg0ep+&06;I5Yq$(yLHkHECr>UtPC&x z4*BXZcmRWPmZtzW!=wO)3271xDh;c>HNc`mTwpPv0W3chMHo~TGAICbd1^4!^yY29 z?OXMaF(&dqgUVDjpcv2-xj^jU3aYtj71M>bRY3QMgouJn+OlvJ)EJPK z8kyE9LAy5XJKh=XrCA%GV!ZkFsl^FtWwD&B3l&6Knr7})1d;&)TxrkTTobGM{^%z1|zK`;QK{-)E`sp`YCQGWhkU|4yG)Va%P}dFVuE(ShE( z^KW(ph`PX4uVhcCbDAGd6_W%dgzSFVu+~uZZD%Yt3dV+NJlUTA zRPbwgoKExA{o4Fo^B3?nzq%D0xPKYMF?{+jIC9YsmXN?cnP zZOzyF`7hbET+NM$4T*OC;X> zJsRnz@g==G_j2jV3wL+1{<_R7o6+5SJIgF>sq3}%+M$Uv<>STwE>kzQ_sc%ATVqP< zt|!lb^0H@5Sl|71#ocpED|Wh+|NXjl`ax-%y#Jri+}3EBe=mIV$==IS8y9O;nAL_x zY}ylLwQHBftJv=8iI*FvitT)O;M}SU?`ul7_=@bi-C-(HRq?z1c;7}2n+>jdn+jW) z&pp-^Ikr<;_U#k5HDRsmQd;w-=(qm-wA*BgU54APwzG_dy+`l;x+h~UI4d~Z+nw*o zuis`|xs#vTex04?UVPhXxgamAadxsuX4*IVD?&i#;~>A9c1GjX`zzl0i~leau}f=N z)wJqRw#bL@XVbZizftmiBEG@TslQ>&3}ejbF&pL1?S`f P3lauTS3j3^P6 + + + + + +HIP: Heterogenous-computing Interface for Portability: Member List + + + + + + + + + +
                  +
                  + + + + + + +
                  +
                  HIP: Heterogenous-computing Interface for Portability +
                  +
                  +
                  + + + + + + + + + +
                  + +
                  + +
                  +
                  +
                  +
                  StagingBuffer Member List
                  +
                  +
                  + +

                  This is the complete list of members for StagingBuffer, including all inherited members.

                  + + + + + + + + +
                  _max_buffers (defined in StagingBuffer)StagingBufferstatic
                  CopyDeviceToHost(void *dst, const void *src, size_t sizeBytes, hsa_signal_t *waitFor) (defined in StagingBuffer)StagingBuffer
                  CopyDeviceToHostPinInPlace(void *dst, const void *src, size_t sizeBytes, hsa_signal_t *waitFor) (defined in StagingBuffer)StagingBuffer
                  CopyHostToDevice(void *dst, const void *src, size_t sizeBytes, hsa_signal_t *waitFor) (defined in StagingBuffer)StagingBuffer
                  CopyHostToDevicePinInPlace(void *dst, const void *src, size_t sizeBytes, hsa_signal_t *waitFor) (defined in StagingBuffer)StagingBuffer
                  StagingBuffer(hsa_agent_t hsaAgent, hsa_region_t systemRegion, size_t bufferSize, int numBuffers) (defined in StagingBuffer)StagingBuffer
                  ~StagingBuffer() (defined in StagingBuffer)StagingBuffer
                  + + + + diff --git a/docs/RuntimeAPI/html/structStagingBuffer.html b/docs/RuntimeAPI/html/structStagingBuffer.html new file mode 100644 index 0000000000..e42819ba22 --- /dev/null +++ b/docs/RuntimeAPI/html/structStagingBuffer.html @@ -0,0 +1,131 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: StagingBuffer Struct Reference + + + + + + + + + +
                  +
                  + + + + + + +
                  +
                  HIP: Heterogenous-computing Interface for Portability +
                  +
                  +
                  + + + + + + + + + +
                  + +
                  + +
                  +
                  + +
                  +
                  StagingBuffer Struct Reference
                  +
                  +
                  + + + + + + + + + + + + +

                  +Public Member Functions

                  StagingBuffer (hsa_agent_t hsaAgent, hsa_region_t systemRegion, size_t bufferSize, int numBuffers)
                   
                  +void CopyHostToDevice (void *dst, const void *src, size_t sizeBytes, hsa_signal_t *waitFor)
                   
                  +void CopyHostToDevicePinInPlace (void *dst, const void *src, size_t sizeBytes, hsa_signal_t *waitFor)
                   
                  +void CopyDeviceToHost (void *dst, const void *src, size_t sizeBytes, hsa_signal_t *waitFor)
                   
                  +void CopyDeviceToHostPinInPlace (void *dst, const void *src, size_t sizeBytes, hsa_signal_t *waitFor)
                   
                  + + + +

                  +Static Public Attributes

                  +static const int _max_buffers = 4
                   
                  +
                  The documentation for this struct was generated from the following files:
                    +
                  • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/staging_buffer.h
                  • +
                  • /home/mangupta/hip_git/rel0.84.0/src/staging_buffer.cpp
                  • +
                  +
                  + + + + diff --git a/docs/RuntimeAPI/html/structchar1.html b/docs/RuntimeAPI/html/structchar1.html deleted file mode 100644 index e0e553098d..0000000000 --- a/docs/RuntimeAPI/html/structchar1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: char1 Struct Reference - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  - -
                  -
                  char1 Struct Reference
                  -
                  -
                  - - - - -

                  -Public Attributes

                  -char x
                   
                  -
                  The documentation for this struct was generated from the following file: -
                  - - - - diff --git a/docs/RuntimeAPI/html/structchar2-members.html b/docs/RuntimeAPI/html/structchar2-members.html deleted file mode 100644 index 8fa9a8ee43..0000000000 --- a/docs/RuntimeAPI/html/structchar2-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  -
                  -
                  char2 Member List
                  -
                  -
                  - -

                  This is the complete list of members for char2, including all inherited members.

                  - - - -
                  x (defined in char2)char2
                  y (defined in char2)char2
                  - - - - diff --git a/docs/RuntimeAPI/html/structchar2.html b/docs/RuntimeAPI/html/structchar2.html deleted file mode 100644 index d7ccd64d98..0000000000 --- a/docs/RuntimeAPI/html/structchar2.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: char2 Struct Reference - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  - -
                  -
                  char2 Struct Reference
                  -
                  -
                  - - - - - - -

                  -Public Attributes

                  -char x
                   
                  -char y
                   
                  -
                  The documentation for this struct was generated from the following file: -
                  - - - - diff --git a/docs/RuntimeAPI/html/structchar3-members.html b/docs/RuntimeAPI/html/structchar3-members.html deleted file mode 100644 index 978710913c..0000000000 --- a/docs/RuntimeAPI/html/structchar3-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  -
                  -
                  char3 Member List
                  -
                  -
                  - -

                  This is the complete list of members for char3, including all inherited members.

                  - - - - -
                  x (defined in char3)char3
                  y (defined in char3)char3
                  z (defined in char3)char3
                  - - - - diff --git a/docs/RuntimeAPI/html/structchar4-members.html b/docs/RuntimeAPI/html/structchar4-members.html deleted file mode 100644 index a5f97d7a05..0000000000 --- a/docs/RuntimeAPI/html/structchar4-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  -
                  -
                  char4 Member List
                  -
                  -
                  - -

                  This is the complete list of members for char4, including all inherited members.

                  - - - - - -
                  w (defined in char4)char4
                  x (defined in char4)char4
                  y (defined in char4)char4
                  z (defined in char4)char4
                  - - - - diff --git a/docs/RuntimeAPI/html/structchar4.html b/docs/RuntimeAPI/html/structchar4.html deleted file mode 100644 index a303937bad..0000000000 --- a/docs/RuntimeAPI/html/structchar4.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: char4 Struct Reference - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  - -
                  -
                  char4 Struct Reference
                  -
                  -
                  - - - - - - - - - - -

                  -Public Attributes

                  -char x
                   
                  -char y
                   
                  -char z
                   
                  -char w
                   
                  -
                  The documentation for this struct was generated from the following file: -
                  - - - - diff --git a/docs/RuntimeAPI/html/structdim3-members.html b/docs/RuntimeAPI/html/structdim3-members.html index 8d97c64f1c..d032c0681f 100644 --- a/docs/RuntimeAPI/html/structdim3-members.html +++ b/docs/RuntimeAPI/html/structdim3-members.html @@ -90,14 +90,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

                  This is the complete list of members for dim3, including all inherited members.

                  - - - - + + +
                  dim3(uint32_t _x=1, uint32_t _y=1, uint32_t _z=1) (defined in dim3)dim3inline
                  xdim3
                  ydim3
                  zdim3
                  xdim3
                  ydim3
                  zdim3
                  diff --git a/docs/RuntimeAPI/html/structdim3.html b/docs/RuntimeAPI/html/structdim3.html index 6cfaad88ee..09fd3810a8 100644 --- a/docs/RuntimeAPI/html/structdim3.html +++ b/docs/RuntimeAPI/html/structdim3.html @@ -84,7 +84,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  @@ -94,12 +93,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

                  #include <hip_runtime_api.h>

                  - - - -

                  -Public Member Functions

                  dim3 (uint32_t _x=1, uint32_t _y=1, uint32_t _z=1)
                   

                  Public Attributes

                  @@ -118,12 +111,12 @@ uint32_t 

                  Detailed Description

                  Struct for data in 3D


                  The documentation for this struct was generated from the following file: diff --git a/docs/RuntimeAPI/html/structdouble1-members.html b/docs/RuntimeAPI/html/structdouble1-members.html deleted file mode 100644 index f4f400e1fa..0000000000 --- a/docs/RuntimeAPI/html/structdouble1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  -
                  -
                  double1 Member List
                  -
                  -
                  - -

                  This is the complete list of members for double1, including all inherited members.

                  - - -
                  x (defined in double1)double1
                  - - - - diff --git a/docs/RuntimeAPI/html/structdouble1.html b/docs/RuntimeAPI/html/structdouble1.html deleted file mode 100644 index 3441ab9e4c..0000000000 --- a/docs/RuntimeAPI/html/structdouble1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: double1 Struct Reference - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  - -
                  -
                  double1 Struct Reference
                  -
                  -
                  - - - - -

                  -Public Attributes

                  -double x
                   
                  -
                  The documentation for this struct was generated from the following file: -
                  - - - - diff --git a/docs/RuntimeAPI/html/structfloat1-members.html b/docs/RuntimeAPI/html/structfloat1-members.html deleted file mode 100644 index 944fcad6bf..0000000000 --- a/docs/RuntimeAPI/html/structfloat1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  -
                  -
                  float1 Member List
                  -
                  -
                  - -

                  This is the complete list of members for float1, including all inherited members.

                  - - -
                  x (defined in float1)float1
                  - - - - diff --git a/docs/RuntimeAPI/html/structfloat1.html b/docs/RuntimeAPI/html/structfloat1.html deleted file mode 100644 index 0220f939d6..0000000000 --- a/docs/RuntimeAPI/html/structfloat1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: float1 Struct Reference - - - - - - - - - -
                  -
                  - - - - - - -
                  -
                  HIP: Heterogenous-computing Interface for Portability -
                  -
                  -
                  - - - - - - - - - -
                  - -
                  - -
                  -
                  - -
                  -
                  float1 Struct Reference
                  -
                  -
                  - - - - -

                  -Public Attributes

                  -float x
                   
                  -
                  The documentation for this struct was generated from the following file: -
                  - - - - diff --git a/docs/RuntimeAPI/html/structhipChannelFormatDesc-members.html b/docs/RuntimeAPI/html/structhipChannelFormatDesc-members.html index bd5d2c1651..39c50e6d86 100644 --- a/docs/RuntimeAPI/html/structhipChannelFormatDesc-members.html +++ b/docs/RuntimeAPI/html/structhipChannelFormatDesc-members.html @@ -94,7 +94,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                  diff --git a/docs/RuntimeAPI/html/structhipChannelFormatDesc.html b/docs/RuntimeAPI/html/structhipChannelFormatDesc.html index c6c6e9ee5b..c41de11d98 100644 --- a/docs/RuntimeAPI/html/structhipChannelFormatDesc.html +++ b/docs/RuntimeAPI/html/structhipChannelFormatDesc.html @@ -98,12 +98,12 @@ int _dummy  
                  The documentation for this struct was generated from the following file:
                    -
                  • /home/bensander/HIP-privatestaging/include/hcc_detail/hip_texture.h
                  • +
                  • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_texture.h
                  diff --git a/docs/RuntimeAPI/html/structhipDeviceArch__t-members.html b/docs/RuntimeAPI/html/structhipDeviceArch__t-members.html index d04626c34d..0e942bc0f6 100644 --- a/docs/RuntimeAPI/html/structhipDeviceArch__t-members.html +++ b/docs/RuntimeAPI/html/structhipDeviceArch__t-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structhipDeviceArch__t.html b/docs/RuntimeAPI/html/structhipDeviceArch__t.html index d09c7d3c6d..6f4c668d1a 100644 --- a/docs/RuntimeAPI/html/structhipDeviceArch__t.html +++ b/docs/RuntimeAPI/html/structhipDeviceArch__t.html @@ -163,12 +163,12 @@ unsigned  
                  The documentation for this struct was generated from the following file:
                  diff --git a/docs/RuntimeAPI/html/structhipDeviceProp__t-members.html b/docs/RuntimeAPI/html/structhipDeviceProp__t-members.html index 4dc810d670..192f0b81d3 100644 --- a/docs/RuntimeAPI/html/structhipDeviceProp__t-members.html +++ b/docs/RuntimeAPI/html/structhipDeviceProp__t-members.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structhipDeviceProp__t.html b/docs/RuntimeAPI/html/structhipDeviceProp__t.html index 913cab44ed..fdf4a3eb4a 100644 --- a/docs/RuntimeAPI/html/structhipDeviceProp__t.html +++ b/docs/RuntimeAPI/html/structhipDeviceProp__t.html @@ -203,12 +203,12 @@ int 

                  Detailed Description

                  hipDeviceProp


                  The documentation for this struct was generated from the following file: diff --git a/docs/RuntimeAPI/html/structhipEvent__t-members.html b/docs/RuntimeAPI/html/structhipEvent__t-members.html index 9f26bc8827..2b65f6f763 100644 --- a/docs/RuntimeAPI/html/structhipEvent__t-members.html +++ b/docs/RuntimeAPI/html/structhipEvent__t-members.html @@ -94,7 +94,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structhipEvent__t.html b/docs/RuntimeAPI/html/structhipEvent__t.html index 5513b7a405..cf54bdab84 100644 --- a/docs/RuntimeAPI/html/structhipEvent__t.html +++ b/docs/RuntimeAPI/html/structhipEvent__t.html @@ -98,12 +98,12 @@ struct ihipEvent_t *   
                  The documentation for this struct was generated from the following file: diff --git a/docs/RuntimeAPI/html/structhipPointerAttribute__t-members.html b/docs/RuntimeAPI/html/structhipPointerAttribute__t-members.html new file mode 100644 index 0000000000..eef653815e --- /dev/null +++ b/docs/RuntimeAPI/html/structhipPointerAttribute__t-members.html @@ -0,0 +1,107 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: Member List + + + + + + + + + +
                  +
                  + + + + + + +
                  +
                  HIP: Heterogenous-computing Interface for Portability +
                  +
                  +
                  + + + + + + + + + +
                  + +
                  + +
                  +
                  +
                  +
                  hipPointerAttribute_t Member List
                  +
                  +
                  + +

                  This is the complete list of members for hipPointerAttribute_t, including all inherited members.

                  + + + + + + + +
                  allocationFlags (defined in hipPointerAttribute_t)hipPointerAttribute_t
                  device (defined in hipPointerAttribute_t)hipPointerAttribute_t
                  devicePointer (defined in hipPointerAttribute_t)hipPointerAttribute_t
                  hostPointer (defined in hipPointerAttribute_t)hipPointerAttribute_t
                  isManaged (defined in hipPointerAttribute_t)hipPointerAttribute_t
                  memoryType (defined in hipPointerAttribute_t)hipPointerAttribute_t
                  + + + + diff --git a/docs/RuntimeAPI/html/structhipPointerAttribute__t.html b/docs/RuntimeAPI/html/structhipPointerAttribute__t.html new file mode 100644 index 0000000000..87021957d5 --- /dev/null +++ b/docs/RuntimeAPI/html/structhipPointerAttribute__t.html @@ -0,0 +1,130 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: hipPointerAttribute_t Struct Reference + + + + + + + + + +
                  +
                  + + + + + + +
                  +
                  HIP: Heterogenous-computing Interface for Portability +
                  +
                  +
                  + + + + + + + + + +
                  + +
                  + +
                  +
                  + +
                  +
                  hipPointerAttribute_t Struct Reference
                  +
                  +
                  + +

                  #include <hip_runtime_api.h>

                  + + + + + + + + + + + + + + +

                  +Public Attributes

                  +enum hipMemoryType memoryType
                   
                  +int device
                   
                  +void * devicePointer
                   
                  +void * hostPointer
                   
                  +int isManaged
                   
                  +unsigned allocationFlags
                   
                  +

                  Detailed Description

                  +

                  Pointer attributes

                  +

                  The documentation for this struct was generated from the following file: +
                  + + + + diff --git a/docs/RuntimeAPI/html/structihipEvent__t-members.html b/docs/RuntimeAPI/html/structihipEvent__t-members.html index 7035ef34e3..7623e17249 100644 --- a/docs/RuntimeAPI/html/structihipEvent__t-members.html +++ b/docs/RuntimeAPI/html/structihipEvent__t-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structihipEvent__t.html b/docs/RuntimeAPI/html/structihipEvent__t.html index b0f9f2c7ef..26b4c2a9cf 100644 --- a/docs/RuntimeAPI/html/structihipEvent__t.html +++ b/docs/RuntimeAPI/html/structihipEvent__t.html @@ -112,14 +112,13 @@ uint64_t _timestamp_copy_seq_id   -
                  The documentation for this struct was generated from the following files:
                    -
                  • /home/bensander/HIP-privatestaging/src/hip_hcc.cpp
                  • -
                  • /home/bensander/HIP-privatestaging/src/hip_hcc2.cpp
                  • +
                    The documentation for this struct was generated from the following file:
                      +
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    diff --git a/docs/RuntimeAPI/html/structihipSignal__t-members.html b/docs/RuntimeAPI/html/structihipSignal__t-members.html new file mode 100644 index 0000000000..6461109109 --- /dev/null +++ b/docs/RuntimeAPI/html/structihipSignal__t-members.html @@ -0,0 +1,107 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: Member List + + + + + + + + + +
                    +
                    + + + + + + +
                    +
                    HIP: Heterogenous-computing Interface for Portability +
                    +
                    +
                    + + + + + + + + + +
                    + +
                    + +
                    +
                    +
                    +
                    ihipSignal_t Member List
                    +
                    +
                    + +

                    This is the complete list of members for ihipSignal_t, including all inherited members.

                    + + + + + + + +
                    _hsa_signal (defined in ihipSignal_t)ihipSignal_t
                    _index (defined in ihipSignal_t)ihipSignal_t
                    _sig_id (defined in ihipSignal_t)ihipSignal_t
                    ihipSignal_t() (defined in ihipSignal_t)ihipSignal_t
                    release() (defined in ihipSignal_t)ihipSignal_t
                    ~ihipSignal_t() (defined in ihipSignal_t)ihipSignal_t
                    + + + + diff --git a/docs/RuntimeAPI/html/structihipStream__t.html b/docs/RuntimeAPI/html/structihipSignal__t.html similarity index 77% rename from docs/RuntimeAPI/html/structihipStream__t.html rename to docs/RuntimeAPI/html/structihipSignal__t.html index 264d5ffd81..6d1372a29d 100644 --- a/docs/RuntimeAPI/html/structihipStream__t.html +++ b/docs/RuntimeAPI/html/structihipSignal__t.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: ihipStream_t Struct Reference +HIP: Heterogenous-computing Interface for Portability: ihipSignal_t Struct Reference @@ -86,40 +86,38 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); +List of all members
                    -
                    ihipStream_t Struct Reference
                    +
                    ihipSignal_t Struct Reference
                    - - + +

                    Public Member Functions

                    ihipStream_t (unsigned device_index, hc::accelerator_view av, unsigned int flags)
                     
                    +void release ()
                     
                    - - - - - - - - + + + + + +

                    Public Attributes

                    -unsigned _device_index
                     
                    -hc::accelerator_view _av
                     
                    -unsigned _flags
                     
                    -ihipCommand_t _last_command
                     
                    +hsa_signal_t _hsa_signal
                     
                    +int _index
                     
                    +SIGSEQNUM _sig_id
                     
                    -
                    The documentation for this struct was generated from the following file:
                      -
                    • /home/bensander/HIP.public/src/hip_hcc.cpp
                    • +
                      The documentation for this struct was generated from the following files:
                        +
                      • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                      • +
                      • /home/mangupta/hip_git/rel0.84.0/src/hip_hcc.cpp
                    diff --git a/docs/RuntimeAPI/html/structint1-members.html b/docs/RuntimeAPI/html/structint1-members.html deleted file mode 100644 index 196b794b05..0000000000 --- a/docs/RuntimeAPI/html/structint1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    int1 Member List
                    -
                    -
                    - -

                    This is the complete list of members for int1, including all inherited members.

                    - - -
                    x (defined in int1)int1
                    - - - - diff --git a/docs/RuntimeAPI/html/structint1.html b/docs/RuntimeAPI/html/structint1.html deleted file mode 100644 index 927f152743..0000000000 --- a/docs/RuntimeAPI/html/structint1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: int1 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    int1 Struct Reference
                    -
                    -
                    - - - - -

                    -Public Attributes

                    -int x
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structlong1-members.html b/docs/RuntimeAPI/html/structlong1-members.html deleted file mode 100644 index c8e0926d51..0000000000 --- a/docs/RuntimeAPI/html/structlong1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    long1 Member List
                    -
                    -
                    - -

                    This is the complete list of members for long1, including all inherited members.

                    - - -
                    x (defined in long1)long1
                    - - - - diff --git a/docs/RuntimeAPI/html/structlong1.html b/docs/RuntimeAPI/html/structlong1.html deleted file mode 100644 index 632e9e5a74..0000000000 --- a/docs/RuntimeAPI/html/structlong1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: long1 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    long1 Struct Reference
                    -
                    -
                    - - - - -

                    -Public Attributes

                    -long x
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structlong2-members.html b/docs/RuntimeAPI/html/structlong2-members.html deleted file mode 100644 index e11171e23e..0000000000 --- a/docs/RuntimeAPI/html/structlong2-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    long2 Member List
                    -
                    -
                    - -

                    This is the complete list of members for long2, including all inherited members.

                    - - - -
                    x (defined in long2)long2
                    y (defined in long2)long2
                    - - - - diff --git a/docs/RuntimeAPI/html/structlong2.html b/docs/RuntimeAPI/html/structlong2.html deleted file mode 100644 index 004fa1f3fa..0000000000 --- a/docs/RuntimeAPI/html/structlong2.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: long2 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    long2 Struct Reference
                    -
                    -
                    - - - - - - -

                    -Public Attributes

                    -long x
                     
                    -long y
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structlong3-members.html b/docs/RuntimeAPI/html/structlong3-members.html deleted file mode 100644 index 1546f481c4..0000000000 --- a/docs/RuntimeAPI/html/structlong3-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    long3 Member List
                    -
                    -
                    - -

                    This is the complete list of members for long3, including all inherited members.

                    - - - - -
                    x (defined in long3)long3
                    y (defined in long3)long3
                    z (defined in long3)long3
                    - - - - diff --git a/docs/RuntimeAPI/html/structlong3.html b/docs/RuntimeAPI/html/structlong3.html deleted file mode 100644 index 228ab4bb71..0000000000 --- a/docs/RuntimeAPI/html/structlong3.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: long3 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    long3 Struct Reference
                    -
                    -
                    - - - - - - - - -

                    -Public Attributes

                    -long x
                     
                    -long y
                     
                    -long z
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structlong4-members.html b/docs/RuntimeAPI/html/structlong4-members.html deleted file mode 100644 index c05faa32fb..0000000000 --- a/docs/RuntimeAPI/html/structlong4-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    long4 Member List
                    -
                    -
                    - -

                    This is the complete list of members for long4, including all inherited members.

                    - - - - - -
                    w (defined in long4)long4
                    x (defined in long4)long4
                    y (defined in long4)long4
                    z (defined in long4)long4
                    - - - - diff --git a/docs/RuntimeAPI/html/structlong4.html b/docs/RuntimeAPI/html/structlong4.html deleted file mode 100644 index 8cf6b0e925..0000000000 --- a/docs/RuntimeAPI/html/structlong4.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: long4 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    long4 Struct Reference
                    -
                    -
                    - - - - - - - - - - -

                    -Public Attributes

                    -long x
                     
                    -long y
                     
                    -long z
                     
                    -long w
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structlonglong1-members.html b/docs/RuntimeAPI/html/structlonglong1-members.html deleted file mode 100644 index cc8483c650..0000000000 --- a/docs/RuntimeAPI/html/structlonglong1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    longlong1 Member List
                    -
                    -
                    - -

                    This is the complete list of members for longlong1, including all inherited members.

                    - - -
                    x (defined in longlong1)longlong1
                    - - - - diff --git a/docs/RuntimeAPI/html/structlonglong1.html b/docs/RuntimeAPI/html/structlonglong1.html deleted file mode 100644 index f347efcba4..0000000000 --- a/docs/RuntimeAPI/html/structlonglong1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: longlong1 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    longlong1 Struct Reference
                    -
                    -
                    - - - - -

                    -Public Attributes

                    -long long x
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structlonglong2-members.html b/docs/RuntimeAPI/html/structlonglong2-members.html deleted file mode 100644 index d60b7542b7..0000000000 --- a/docs/RuntimeAPI/html/structlonglong2-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    longlong2 Member List
                    -
                    -
                    - -

                    This is the complete list of members for longlong2, including all inherited members.

                    - - - -
                    x (defined in longlong2)longlong2
                    y (defined in longlong2)longlong2
                    - - - - diff --git a/docs/RuntimeAPI/html/structlonglong2.html b/docs/RuntimeAPI/html/structlonglong2.html deleted file mode 100644 index 2aae373a41..0000000000 --- a/docs/RuntimeAPI/html/structlonglong2.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: longlong2 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    longlong2 Struct Reference
                    -
                    -
                    - - - - - - -

                    -Public Attributes

                    -long long x
                     
                    -long long y
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structlonglong3-members.html b/docs/RuntimeAPI/html/structlonglong3-members.html deleted file mode 100644 index 71f382899c..0000000000 --- a/docs/RuntimeAPI/html/structlonglong3-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    longlong3 Member List
                    -
                    -
                    - -

                    This is the complete list of members for longlong3, including all inherited members.

                    - - - - -
                    x (defined in longlong3)longlong3
                    y (defined in longlong3)longlong3
                    z (defined in longlong3)longlong3
                    - - - - diff --git a/docs/RuntimeAPI/html/structlonglong3.html b/docs/RuntimeAPI/html/structlonglong3.html deleted file mode 100644 index 7ffce23e52..0000000000 --- a/docs/RuntimeAPI/html/structlonglong3.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: longlong3 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    longlong3 Struct Reference
                    -
                    -
                    - - - - - - - - -

                    -Public Attributes

                    -long long x
                     
                    -long long y
                     
                    -long long z
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structlonglong4-members.html b/docs/RuntimeAPI/html/structlonglong4-members.html deleted file mode 100644 index 797d534178..0000000000 --- a/docs/RuntimeAPI/html/structlonglong4-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    longlong4 Member List
                    -
                    -
                    - -

                    This is the complete list of members for longlong4, including all inherited members.

                    - - - - - -
                    w (defined in longlong4)longlong4
                    x (defined in longlong4)longlong4
                    y (defined in longlong4)longlong4
                    z (defined in longlong4)longlong4
                    - - - - diff --git a/docs/RuntimeAPI/html/structlonglong4.html b/docs/RuntimeAPI/html/structlonglong4.html deleted file mode 100644 index bfe3df64b5..0000000000 --- a/docs/RuntimeAPI/html/structlonglong4.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: longlong4 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    longlong4 Struct Reference
                    -
                    -
                    - - - - - - - - - - -

                    -Public Attributes

                    -long long x
                     
                    -long long y
                     
                    -long long z
                     
                    -long long w
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structshort1-members.html b/docs/RuntimeAPI/html/structshort1-members.html deleted file mode 100644 index 4e4a62fe07..0000000000 --- a/docs/RuntimeAPI/html/structshort1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    short1 Member List
                    -
                    -
                    - -

                    This is the complete list of members for short1, including all inherited members.

                    - - -
                    x (defined in short1)short1
                    - - - - diff --git a/docs/RuntimeAPI/html/structshort1.html b/docs/RuntimeAPI/html/structshort1.html deleted file mode 100644 index c2e9809d03..0000000000 --- a/docs/RuntimeAPI/html/structshort1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: short1 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    short1 Struct Reference
                    -
                    -
                    - - - - -

                    -Public Attributes

                    -short x
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structshort2-members.html b/docs/RuntimeAPI/html/structshort2-members.html deleted file mode 100644 index cb6de02834..0000000000 --- a/docs/RuntimeAPI/html/structshort2-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    short2 Member List
                    -
                    -
                    - -

                    This is the complete list of members for short2, including all inherited members.

                    - - - -
                    x (defined in short2)short2
                    y (defined in short2)short2
                    - - - - diff --git a/docs/RuntimeAPI/html/structshort2.html b/docs/RuntimeAPI/html/structshort2.html deleted file mode 100644 index 48067316f6..0000000000 --- a/docs/RuntimeAPI/html/structshort2.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: short2 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    short2 Struct Reference
                    -
                    -
                    - - - - - - -

                    -Public Attributes

                    -short x
                     
                    -short y
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structshort3-members.html b/docs/RuntimeAPI/html/structshort3-members.html deleted file mode 100644 index 7b07235a40..0000000000 --- a/docs/RuntimeAPI/html/structshort3-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    short3 Member List
                    -
                    -
                    - -

                    This is the complete list of members for short3, including all inherited members.

                    - - - - -
                    x (defined in short3)short3
                    y (defined in short3)short3
                    z (defined in short3)short3
                    - - - - diff --git a/docs/RuntimeAPI/html/structshort3.html b/docs/RuntimeAPI/html/structshort3.html deleted file mode 100644 index b7c9d15748..0000000000 --- a/docs/RuntimeAPI/html/structshort3.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: short3 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    short3 Struct Reference
                    -
                    -
                    - - - - - - - - -

                    -Public Attributes

                    -short x
                     
                    -short y
                     
                    -short z
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structshort4-members.html b/docs/RuntimeAPI/html/structshort4-members.html deleted file mode 100644 index 43b44879e2..0000000000 --- a/docs/RuntimeAPI/html/structshort4-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    short4 Member List
                    -
                    -
                    - -

                    This is the complete list of members for short4, including all inherited members.

                    - - - - - -
                    w (defined in short4)short4
                    x (defined in short4)short4
                    y (defined in short4)short4
                    z (defined in short4)short4
                    - - - - diff --git a/docs/RuntimeAPI/html/structshort4.html b/docs/RuntimeAPI/html/structshort4.html deleted file mode 100644 index 86a8622443..0000000000 --- a/docs/RuntimeAPI/html/structshort4.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: short4 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    short4 Struct Reference
                    -
                    -
                    - - - - - - - - - - -

                    -Public Attributes

                    -short x
                     
                    -short y
                     
                    -short z
                     
                    -short w
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structtexture.png b/docs/RuntimeAPI/html/structtexture.png deleted file mode 100644 index 3a32b1fdbc76287f99cbbfc54b5900362837c688..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 798 zcmeAS@N?(olHy`uVBq!ia0y~yU}Oif12~w0q;jW29*~j<@CkAK|NlRb`Qpvj(*8pe zfGjXRaNq!I=N)+wpSSBJmE?1``K_a`@Z{BX*S23?sLxlb&}j91!=knQ$EyB@UOmQe|Iq9=2iHOv9%eThMHp?Bk^d{zd z^{XqF8mvv~G@04AI|q1hbu(0*mTMFBwPYz`Zg=0f<=2ClU+;Y^dKllF=9HQB_~!QP zGCQlhn};_f-+MIWaHh`A==1&s5;F3v7o2)Eg00wiThnLp8)km@|BF1`}XVkH~N|Jv42gp*i-lGaD?Bh!zT|U)_Pps_wBBp>^<>&ub=GW zkgNVU@5$kdwS@ww-|V}=d)abVT|7gL|8l-G@xLckc|Q1m{VuaEQR2LSz^&cI3>7N% w77Tq~_7^k!_$kC*D8SyJQFy}=7{*^X-RD^dT3B8V2PS3)Pgg&ebxsLQ07CI~=Kufz diff --git a/docs/RuntimeAPI/html/structtextureReference-members.html b/docs/RuntimeAPI/html/structtextureReference-members.html index f971eeabae..6e42d07c6d 100644 --- a/docs/RuntimeAPI/html/structtextureReference-members.html +++ b/docs/RuntimeAPI/html/structtextureReference-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structtextureReference.html b/docs/RuntimeAPI/html/structtextureReference.html index 042d943628..a7592835bd 100644 --- a/docs/RuntimeAPI/html/structtextureReference.html +++ b/docs/RuntimeAPI/html/structtextureReference.html @@ -90,15 +90,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    textureReference Struct Reference
                    -
                    -Inheritance diagram for textureReference:
                    -
                    -
                    - - -texture< T, texType, hipTextureReadMode > - -
                    @@ -113,12 +104,12 @@ bool 

                    Public Attributes

                    normalized 

                    The documentation for this struct was generated from the following file:
                      -
                    • /home/bensander/HIP-privatestaging/include/hcc_detail/hip_texture.h
                    • +
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_texture.h
                    diff --git a/docs/RuntimeAPI/html/structtextureReference.png b/docs/RuntimeAPI/html/structtextureReference.png deleted file mode 100644 index 5447140274dbbc457d3a0c694030f1d86e04505b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 808 zcmeAS@N?(olHy`uVBq!ia0y~yU}Oif12~w0q;jW29*~j<@CkAK|NlRb`Qpvj(*8pe zfGjXRaNq!I=N)+6=v~=XdbUhw#Nnall@p^`7}6LR?ydZ7@x^u7?!B_JZfwn%6Z%{rOPgVj^Y&-X z7E*r8>{Oy<*X$8w*b{9&pF8-ATUN|U{+By{?D_TJefL&-v59xZ%T%In&VDla9XG=d zoz7;94rYc578uO3=@td9{nK1QMf^Z#YrYao$-LD4A4^y2fRt8UPl+K z*m|w~>nb48>NUwe?vVoDBZo+doB7<0(&{JYUi)}fXYN$%nY;i0 z-Ns+hTxk;jyx^g-c#Vo$_+Op;%M0ygZaFZNo=bGREjRZoDD)<7IlH%0E@#Q<)6W!s zM8-=uUwvJvb9ndXJ3YGW<`eXeJU=XUA>*~rW}WT|_S=;lGJDQD=FgsZ&Z=YS?V0Po znyhGLEY5IK;bh^TFh8`CZ=6x_=f3buXRs z^ll6D$%~(AZZyf+eYn8iB@az4W>^(!}|H^;!4x94)Hg>tR)&IG} zB==42%_`}??pscH@_o8RN3+F*CDSc(WU|(V{$e%!YTDCfar753Su=RL`njxgN@xNA D!V`LH diff --git a/docs/RuntimeAPI/html/structuchar1-members.html b/docs/RuntimeAPI/html/structuchar1-members.html deleted file mode 100644 index a2d9e5a75c..0000000000 --- a/docs/RuntimeAPI/html/structuchar1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    uchar1 Member List
                    -
                    -
                    - -

                    This is the complete list of members for uchar1, including all inherited members.

                    - - -
                    x (defined in uchar1)uchar1
                    - - - - diff --git a/docs/RuntimeAPI/html/structuchar1.html b/docs/RuntimeAPI/html/structuchar1.html deleted file mode 100644 index e1ccab91c2..0000000000 --- a/docs/RuntimeAPI/html/structuchar1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: uchar1 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    uchar1 Struct Reference
                    -
                    -
                    - - - - -

                    -Public Attributes

                    -unsigned char x
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structuchar2-members.html b/docs/RuntimeAPI/html/structuchar2-members.html deleted file mode 100644 index f6195412b8..0000000000 --- a/docs/RuntimeAPI/html/structuchar2-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    uchar2 Member List
                    -
                    -
                    - -

                    This is the complete list of members for uchar2, including all inherited members.

                    - - - -
                    x (defined in uchar2)uchar2
                    y (defined in uchar2)uchar2
                    - - - - diff --git a/docs/RuntimeAPI/html/structuchar2.html b/docs/RuntimeAPI/html/structuchar2.html deleted file mode 100644 index e50d42f883..0000000000 --- a/docs/RuntimeAPI/html/structuchar2.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: uchar2 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    uchar2 Struct Reference
                    -
                    -
                    - - - - - - -

                    -Public Attributes

                    -unsigned char x
                     
                    -unsigned char y
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structuchar3-members.html b/docs/RuntimeAPI/html/structuchar3-members.html deleted file mode 100644 index 2ad6db7003..0000000000 --- a/docs/RuntimeAPI/html/structuchar3-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    uchar3 Member List
                    -
                    -
                    - -

                    This is the complete list of members for uchar3, including all inherited members.

                    - - - - -
                    x (defined in uchar3)uchar3
                    y (defined in uchar3)uchar3
                    z (defined in uchar3)uchar3
                    - - - - diff --git a/docs/RuntimeAPI/html/structuchar3.html b/docs/RuntimeAPI/html/structuchar3.html deleted file mode 100644 index 4c2640860a..0000000000 --- a/docs/RuntimeAPI/html/structuchar3.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: uchar3 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    uchar3 Struct Reference
                    -
                    -
                    - - - - - - - - -

                    -Public Attributes

                    -unsigned char x
                     
                    -unsigned char y
                     
                    -unsigned char z
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structuchar4-members.html b/docs/RuntimeAPI/html/structuchar4-members.html deleted file mode 100644 index b37288c0a0..0000000000 --- a/docs/RuntimeAPI/html/structuchar4-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    uchar4 Member List
                    -
                    -
                    - -

                    This is the complete list of members for uchar4, including all inherited members.

                    - - - - - -
                    w (defined in uchar4)uchar4
                    x (defined in uchar4)uchar4
                    y (defined in uchar4)uchar4
                    z (defined in uchar4)uchar4
                    - - - - diff --git a/docs/RuntimeAPI/html/structuchar4.html b/docs/RuntimeAPI/html/structuchar4.html deleted file mode 100644 index 4c6074d22c..0000000000 --- a/docs/RuntimeAPI/html/structuchar4.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: uchar4 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    uchar4 Struct Reference
                    -
                    -
                    - - - - - - - - - - -

                    -Public Attributes

                    -unsigned char x
                     
                    -unsigned char y
                     
                    -unsigned char z
                     
                    -unsigned char w
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structuint1-members.html b/docs/RuntimeAPI/html/structuint1-members.html deleted file mode 100644 index 6eec4356c7..0000000000 --- a/docs/RuntimeAPI/html/structuint1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    uint1 Member List
                    -
                    -
                    - -

                    This is the complete list of members for uint1, including all inherited members.

                    - - -
                    x (defined in uint1)uint1
                    - - - - diff --git a/docs/RuntimeAPI/html/structuint1.html b/docs/RuntimeAPI/html/structuint1.html deleted file mode 100644 index 8ca11c3a38..0000000000 --- a/docs/RuntimeAPI/html/structuint1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: uint1 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    uint1 Struct Reference
                    -
                    -
                    - - - - -

                    -Public Attributes

                    -unsigned int x
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structulong1-members.html b/docs/RuntimeAPI/html/structulong1-members.html deleted file mode 100644 index 669f7fc749..0000000000 --- a/docs/RuntimeAPI/html/structulong1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ulong1 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ulong1, including all inherited members.

                    - - -
                    x (defined in ulong1)ulong1
                    - - - - diff --git a/docs/RuntimeAPI/html/structulong1.html b/docs/RuntimeAPI/html/structulong1.html deleted file mode 100644 index 28e2087d73..0000000000 --- a/docs/RuntimeAPI/html/structulong1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ulong1 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ulong1 Struct Reference
                    -
                    -
                    - - - - -

                    -Public Attributes

                    -unsigned long x
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structulong2-members.html b/docs/RuntimeAPI/html/structulong2-members.html deleted file mode 100644 index 9120b6de15..0000000000 --- a/docs/RuntimeAPI/html/structulong2-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ulong2 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ulong2, including all inherited members.

                    - - - -
                    x (defined in ulong2)ulong2
                    y (defined in ulong2)ulong2
                    - - - - diff --git a/docs/RuntimeAPI/html/structulong2.html b/docs/RuntimeAPI/html/structulong2.html deleted file mode 100644 index 1f53589875..0000000000 --- a/docs/RuntimeAPI/html/structulong2.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ulong2 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ulong2 Struct Reference
                    -
                    -
                    - - - - - - -

                    -Public Attributes

                    -unsigned long x
                     
                    -unsigned long y
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structulong3-members.html b/docs/RuntimeAPI/html/structulong3-members.html deleted file mode 100644 index 8bd18f2919..0000000000 --- a/docs/RuntimeAPI/html/structulong3-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ulong3 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ulong3, including all inherited members.

                    - - - - -
                    x (defined in ulong3)ulong3
                    y (defined in ulong3)ulong3
                    z (defined in ulong3)ulong3
                    - - - - diff --git a/docs/RuntimeAPI/html/structulong3.html b/docs/RuntimeAPI/html/structulong3.html deleted file mode 100644 index 7815a49ac0..0000000000 --- a/docs/RuntimeAPI/html/structulong3.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ulong3 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ulong3 Struct Reference
                    -
                    -
                    - - - - - - - - -

                    -Public Attributes

                    -unsigned long x
                     
                    -unsigned long y
                     
                    -unsigned long z
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structulong4-members.html b/docs/RuntimeAPI/html/structulong4-members.html deleted file mode 100644 index 574d994e3e..0000000000 --- a/docs/RuntimeAPI/html/structulong4-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ulong4 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ulong4, including all inherited members.

                    - - - - - -
                    w (defined in ulong4)ulong4
                    x (defined in ulong4)ulong4
                    y (defined in ulong4)ulong4
                    z (defined in ulong4)ulong4
                    - - - - diff --git a/docs/RuntimeAPI/html/structulong4.html b/docs/RuntimeAPI/html/structulong4.html deleted file mode 100644 index 88ef7a5ff9..0000000000 --- a/docs/RuntimeAPI/html/structulong4.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ulong4 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ulong4 Struct Reference
                    -
                    -
                    - - - - - - - - - - -

                    -Public Attributes

                    -unsigned long x
                     
                    -unsigned long y
                     
                    -unsigned long z
                     
                    -unsigned long w
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structulonglong1-members.html b/docs/RuntimeAPI/html/structulonglong1-members.html deleted file mode 100644 index a87a99387b..0000000000 --- a/docs/RuntimeAPI/html/structulonglong1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ulonglong1 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ulonglong1, including all inherited members.

                    - - -
                    x (defined in ulonglong1)ulonglong1
                    - - - - diff --git a/docs/RuntimeAPI/html/structulonglong1.html b/docs/RuntimeAPI/html/structulonglong1.html deleted file mode 100644 index c873cf8d93..0000000000 --- a/docs/RuntimeAPI/html/structulonglong1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ulonglong1 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ulonglong1 Struct Reference
                    -
                    -
                    - - - - -

                    -Public Attributes

                    -unsigned long long x
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structulonglong2-members.html b/docs/RuntimeAPI/html/structulonglong2-members.html deleted file mode 100644 index 6ba70a9646..0000000000 --- a/docs/RuntimeAPI/html/structulonglong2-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ulonglong2 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ulonglong2, including all inherited members.

                    - - - -
                    x (defined in ulonglong2)ulonglong2
                    y (defined in ulonglong2)ulonglong2
                    - - - - diff --git a/docs/RuntimeAPI/html/structulonglong2.html b/docs/RuntimeAPI/html/structulonglong2.html deleted file mode 100644 index c58d2eaf5d..0000000000 --- a/docs/RuntimeAPI/html/structulonglong2.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ulonglong2 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ulonglong2 Struct Reference
                    -
                    -
                    - - - - - - -

                    -Public Attributes

                    -unsigned long long x
                     
                    -unsigned long long y
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structulonglong3-members.html b/docs/RuntimeAPI/html/structulonglong3-members.html deleted file mode 100644 index b057dc42db..0000000000 --- a/docs/RuntimeAPI/html/structulonglong3-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ulonglong3 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ulonglong3, including all inherited members.

                    - - - - -
                    x (defined in ulonglong3)ulonglong3
                    y (defined in ulonglong3)ulonglong3
                    z (defined in ulonglong3)ulonglong3
                    - - - - diff --git a/docs/RuntimeAPI/html/structulonglong3.html b/docs/RuntimeAPI/html/structulonglong3.html deleted file mode 100644 index 1aa9f27840..0000000000 --- a/docs/RuntimeAPI/html/structulonglong3.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ulonglong3 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ulonglong3 Struct Reference
                    -
                    -
                    - - - - - - - - -

                    -Public Attributes

                    -unsigned long long x
                     
                    -unsigned long long y
                     
                    -unsigned long long z
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structulonglong4-members.html b/docs/RuntimeAPI/html/structulonglong4-members.html deleted file mode 100644 index 8933649bcf..0000000000 --- a/docs/RuntimeAPI/html/structulonglong4-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ulonglong4 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ulonglong4, including all inherited members.

                    - - - - - -
                    w (defined in ulonglong4)ulonglong4
                    x (defined in ulonglong4)ulonglong4
                    y (defined in ulonglong4)ulonglong4
                    z (defined in ulonglong4)ulonglong4
                    - - - - diff --git a/docs/RuntimeAPI/html/structulonglong4.html b/docs/RuntimeAPI/html/structulonglong4.html deleted file mode 100644 index a745d34ecf..0000000000 --- a/docs/RuntimeAPI/html/structulonglong4.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ulonglong4 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ulonglong4 Struct Reference
                    -
                    -
                    - - - - - - - - - - -

                    -Public Attributes

                    -unsigned long long x
                     
                    -unsigned long long y
                     
                    -unsigned long long z
                     
                    -unsigned long long w
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structushort1-members.html b/docs/RuntimeAPI/html/structushort1-members.html deleted file mode 100644 index 084a06bb60..0000000000 --- a/docs/RuntimeAPI/html/structushort1-members.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ushort1 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ushort1, including all inherited members.

                    - - -
                    x (defined in ushort1)ushort1
                    - - - - diff --git a/docs/RuntimeAPI/html/structushort1.html b/docs/RuntimeAPI/html/structushort1.html deleted file mode 100644 index 10eeae3da1..0000000000 --- a/docs/RuntimeAPI/html/structushort1.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ushort1 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ushort1 Struct Reference
                    -
                    -
                    - - - - -

                    -Public Attributes

                    -unsigned short x
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structushort2-members.html b/docs/RuntimeAPI/html/structushort2-members.html deleted file mode 100644 index 4219cfcc0d..0000000000 --- a/docs/RuntimeAPI/html/structushort2-members.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ushort2 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ushort2, including all inherited members.

                    - - - -
                    x (defined in ushort2)ushort2
                    y (defined in ushort2)ushort2
                    - - - - diff --git a/docs/RuntimeAPI/html/structushort2.html b/docs/RuntimeAPI/html/structushort2.html deleted file mode 100644 index b6523a4a17..0000000000 --- a/docs/RuntimeAPI/html/structushort2.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ushort2 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ushort2 Struct Reference
                    -
                    -
                    - - - - - - -

                    -Public Attributes

                    -unsigned short x
                     
                    -unsigned short y
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structushort3-members.html b/docs/RuntimeAPI/html/structushort3-members.html deleted file mode 100644 index 0aa517b830..0000000000 --- a/docs/RuntimeAPI/html/structushort3-members.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ushort3 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ushort3, including all inherited members.

                    - - - - -
                    x (defined in ushort3)ushort3
                    y (defined in ushort3)ushort3
                    z (defined in ushort3)ushort3
                    - - - - diff --git a/docs/RuntimeAPI/html/structushort3.html b/docs/RuntimeAPI/html/structushort3.html deleted file mode 100644 index 590a5579a6..0000000000 --- a/docs/RuntimeAPI/html/structushort3.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ushort3 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ushort3 Struct Reference
                    -
                    -
                    - - - - - - - - -

                    -Public Attributes

                    -unsigned short x
                     
                    -unsigned short y
                     
                    -unsigned short z
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/structushort4-members.html b/docs/RuntimeAPI/html/structushort4-members.html deleted file mode 100644 index b103b96ed8..0000000000 --- a/docs/RuntimeAPI/html/structushort4-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: Member List - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    -
                    -
                    ushort4 Member List
                    -
                    -
                    - -

                    This is the complete list of members for ushort4, including all inherited members.

                    - - - - - -
                    w (defined in ushort4)ushort4
                    x (defined in ushort4)ushort4
                    y (defined in ushort4)ushort4
                    z (defined in ushort4)ushort4
                    - - - - diff --git a/docs/RuntimeAPI/html/structushort4.html b/docs/RuntimeAPI/html/structushort4.html deleted file mode 100644 index 55ddd7c472..0000000000 --- a/docs/RuntimeAPI/html/structushort4.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -HIP: Heterogenous-computing Interface for Portability: ushort4 Struct Reference - - - - - - - - - -
                    -
                    - - - - - - -
                    -
                    HIP: Heterogenous-computing Interface for Portability -
                    -
                    -
                    - - - - - - - - - -
                    - -
                    - -
                    -
                    - -
                    -
                    ushort4 Struct Reference
                    -
                    -
                    - - - - - - - - - - -

                    -Public Attributes

                    -unsigned short x
                     
                    -unsigned short y
                     
                    -unsigned short z
                     
                    -unsigned short w
                     
                    -
                    The documentation for this struct was generated from the following file: -
                    - - - - diff --git a/docs/RuntimeAPI/html/trace__helper_8h_source.html b/docs/RuntimeAPI/html/trace__helper_8h_source.html new file mode 100644 index 0000000000..ad334e43a6 --- /dev/null +++ b/docs/RuntimeAPI/html/trace__helper_8h_source.html @@ -0,0 +1,231 @@ + + + + + + +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/trace_helper.h Source File + + + + + + + + + +
                    +
                    + + + + + + +
                    +
                    HIP: Heterogenous-computing Interface for Portability +
                    +
                    +
                    + + + + + + + + + +
                    + +
                    + + +
                    +
                    +
                    +
                    trace_helper.h
                    +
                    +
                    +
                    1 /*
                    +
                    2 Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
                    +
                    3 Permission is hereby granted, free of charge, to any person obtaining a copy
                    +
                    4 of this software and associated documentation files (the "Software"), to deal
                    +
                    5 in the Software without restriction, including without limitation the rights
                    +
                    6 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                    +
                    7 copies of the Software, and to permit persons to whom the Software is
                    +
                    8 furnished to do so, subject to the following conditions:
                    +
                    9 The above copyright notice and this permission notice shall be included in
                    +
                    10 all copies or substantial portions of the Software.
                    +
                    11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR
                    +
                    12 IMPLIED, INNCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                    +
                    13 FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
                    +
                    14 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANNY CLAIM, DAMAGES OR OTHER
                    +
                    15 LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                    +
                    16 OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
                    +
                    17 THE SOFTWARE.
                    +
                    18 */
                    +
                    19 //#pragma once
                    +
                    20 
                    +
                    21 #ifndef TRACE_HELPER_H
                    +
                    22 #define TRACE_HELPER_H
                    +
                    23 
                    +
                    24 #include <iostream>
                    +
                    25 #include <iomanip>
                    +
                    26 #include <string>
                    +
                    27 
                    +
                    28 //---
                    +
                    29 // Helper functions to convert HIP function arguments into strings.
                    +
                    30 // Handles POD data types as well as enumerations (ie hipMemcpyKind).
                    +
                    31 // The implementation uses C++11 variadic templates and template specialization.
                    +
                    32 // The hipMemcpyKind example below is a good example that shows how to implement conversion for a new HSA type.
                    +
                    33 
                    +
                    34 
                    +
                    35 // Handy macro to convert an enumeration to a stringified version of same:
                    +
                    36 #define CASE_STR(x) case x: return #x;
                    +
                    37 
                    +
                    38 
                    +
                    39 // Building block functions:
                    +
                    40 template <typename T>
                    +
                    41 inline std::string ToHexString(T v)
                    +
                    42 {
                    +
                    43  std::ostringstream ss;
                    +
                    44  ss << "0x" << std::hex << v;
                    +
                    45  return ss.str();
                    +
                    46 };
                    +
                    47 
                    +
                    48 
                    +
                    49 //---
                    +
                    50 // Template overloads for ToString to handle specific types
                    +
                    51 
                    +
                    52 // This is the default which works for most types:
                    +
                    53 template <typename T>
                    +
                    54 inline std::string ToString(T v)
                    +
                    55 {
                    +
                    56  std::ostringstream ss;
                    +
                    57  ss << v;
                    +
                    58  return ss.str();
                    +
                    59 };
                    +
                    60 
                    +
                    61 
                    +
                    62 // hipEvent_t specialization. TODO - maybe add an event ID for debug?
                    +
                    63 template <>
                    +
                    64 inline std::string ToString(hipEvent_t v)
                    +
                    65 {
                    +
                    66  return ToString(&v);
                    +
                    67 };
                    +
                    68 
                    +
                    69 
                    +
                    70 
                    +
                    71 // hipStream_t
                    +
                    72 template <>
                    +
                    73 inline std::string ToString(hipStream_t v)
                    +
                    74 {
                    +
                    75  std::ostringstream ss;
                    +
                    76  if (v == NULL) {
                    +
                    77  ss << "stream:<null>";
                    +
                    78  } else {
                    +
                    79  ss << *v;
                    +
                    80  }
                    +
                    81 
                    +
                    82  return ss.str();
                    +
                    83 };
                    +
                    84 
                    +
                    85 // hipMemcpyKind specialization
                    +
                    86 template <>
                    +
                    87 inline std::string ToString(hipMemcpyKind v)
                    +
                    88 {
                    +
                    89  switch(v) {
                    +
                    90  CASE_STR(hipMemcpyHostToHost);
                    +
                    91  CASE_STR(hipMemcpyHostToDevice);
                    +
                    92  CASE_STR(hipMemcpyDeviceToHost);
                    +
                    93  CASE_STR(hipMemcpyDeviceToDevice);
                    +
                    94  CASE_STR(hipMemcpyDefault);
                    +
                    95  default : return ToHexString(v);
                    +
                    96  };
                    +
                    97 };
                    +
                    98 
                    +
                    99 
                    +
                    100 template <>
                    +
                    101 inline std::string ToString(hipError_t v)
                    +
                    102 {
                    +
                    103  return ihipErrorString(v);
                    +
                    104 };
                    +
                    105 
                    +
                    106 
                    +
                    107 // Catch empty arguments case
                    +
                    108 inline std::string ToString()
                    +
                    109 {
                    +
                    110  return ("");
                    +
                    111 }
                    +
                    112 
                    +
                    113 
                    +
                    114 //---
                    +
                    115 // C++11 variadic template - peels off first argument, converts to string, and calls itself again to peel the next arg.
                    +
                    116 // Strings are automatically separated by comma+space.
                    +
                    117 template <typename T, typename... Args>
                    +
                    118 inline std::string ToString(T first, Args... args)
                    +
                    119 {
                    +
                    120  return ToString(first) + ", " + ToString(args...) ;
                    +
                    121 }
                    +
                    122 
                    +
                    123 #endif
                    +
                    Host-to-Device Copy.
                    Definition: hip_runtime_api.h:131
                    +
                    Device-to-Host Copy.
                    Definition: hip_runtime_api.h:132
                    +
                    hipError_t
                    Definition: hip_runtime_api.h:142
                    +
                    hipMemcpyKind
                    Definition: hip_runtime_api.h:129
                    +
                    Definition: hip_runtime_api.h:47
                    +
                    Device-to-Device Copy.
                    Definition: hip_runtime_api.h:133
                    +
                    Runtime will automatically determine copy-kind based on virtual addresses.
                    Definition: hip_runtime_api.h:134
                    +
                    Host-to-Host Copy.
                    Definition: hip_runtime_api.h:130
                    +
                    + + + + From dfea14c5d4ac964bc57a64d9dad93106a72a6f8c Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Sat, 16 Apr 2016 15:19:32 +0530 Subject: [PATCH 49/82] Bump hcc version dependency for packaging --- packaging/hip_hcc.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/hip_hcc.txt b/packaging/hip_hcc.txt index 4a2947b5bf..0df19b325e 100644 --- a/packaging/hip_hcc.txt +++ b/packaging/hip_hcc.txt @@ -24,12 +24,12 @@ set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR} set(CPACK_GENERATOR "TGZ;DEB;RPM") set(CPACK_BINARY_DEB "ON") set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_BINARY_DIR}/postinst;${PROJECT_BINARY_DIR}/prerm") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip_base (= ${CPACK_PACKAGE_VERSION}), hcc_lc (= 0.10.16154-8191a87-d49f384)") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip_base (= ${CPACK_PACKAGE_VERSION}), hcc_lc (= 0.10.16155-077b4c8-d49f384)") set(CPACK_BINARY_RPM "ON") set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64") set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/postinst") set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/prerm") set(CPACK_RPM_PACKAGE_AUTOREQPROV " no") -set(CPACK_RPM_PACKAGE_REQUIRES "hip_base = ${CPACK_PACKAGE_VERSION}, hcc_lc = 0.10.16154-8191a87-d49f384") +set(CPACK_RPM_PACKAGE_REQUIRES "hip_base = ${CPACK_PACKAGE_VERSION}, hcc_lc = 0.10.16155-077b4c8-d49f384") set(CPACK_SOURCE_GENERATOR "TGZ") include(CPack) From bcaefb81fc682b8d3e2b124aa574b62d77d39230 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Mon, 18 Apr 2016 10:15:35 +0530 Subject: [PATCH 50/82] Fix makefiles in samples --- samples/0_Intro/bit_extract/Makefile | 5 ++++- samples/0_Intro/hcc_dialects/Makefile | 5 ++++- samples/0_Intro/square/Makefile | 5 ++++- samples/1_Utils/hipBusBandwidth/Makefile | 5 ++++- samples/1_Utils/hipDispatchLatency/Makefile | 5 ++++- samples/1_Utils/hipInfo/Makefile | 5 ++++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/samples/0_Intro/bit_extract/Makefile b/samples/0_Intro/bit_extract/Makefile index b71828f5fa..a01f60646e 100644 --- a/samples/0_Intro/bit_extract/Makefile +++ b/samples/0_Intro/bit_extract/Makefile @@ -1,6 +1,9 @@ #Dependencies : [MYHIP]/bin must be in user's path. -HIP_PATH?=../../.. +HIP_PATH?= $(wildcard /opt/rocm/hip) +ifeq (,$(HIP_PATH)) + HIP_PATH=../../.. +endif HIP_PLATFORM=$(shell $(HIP_PATH)/bin/hipconfig --platform) HIPCC=$(HIP_PATH)/bin/hipcc diff --git a/samples/0_Intro/hcc_dialects/Makefile b/samples/0_Intro/hcc_dialects/Makefile index b6e5c10afc..fb8fcc0c32 100644 --- a/samples/0_Intro/hcc_dialects/Makefile +++ b/samples/0_Intro/hcc_dialects/Makefile @@ -7,7 +7,10 @@ HCC_LDFLAGS= `$(HCC_HOME)/bin/hcc-config --ldflags` CPPAMP_CFLAGS= -std=c++amp -stdlib=libc++ -I$(HCC_HOME)/include CPPAMP_LDFLAGS= -std=c++amp -L$(HCC_HOME)/lib -Wl,--rpath=$(HCC_HOME)/lib -lc++ -lc++abi -ldl -lpthread -Wl,--whole-archive -lmcwamp -Wl,--no-whole-archive -HIP_PATH?=/opt/rocm/hip +HIP_PATH?= $(wildcard /opt/rocm/hip) +ifeq (,$(HIP_PATH)) + HIP_PATH=../../.. +endif HIPCC=$(HIP_PATH)/bin/hipcc HIP_PLATFORM=$(shell $(HIP_PATH)/bin/hipconfig --platform) diff --git a/samples/0_Intro/square/Makefile b/samples/0_Intro/square/Makefile index 817c556b26..89921c2072 100644 --- a/samples/0_Intro/square/Makefile +++ b/samples/0_Intro/square/Makefile @@ -1,4 +1,7 @@ -HIP_PATH?=../../.. +HIP_PATH?= $(wildcard /opt/rocm/hip) +ifeq (,$(HIP_PATH)) + HIP_PATH=../../.. +endif HIPCC=$(HIP_PATH)/bin/hipcc all: square.hip.out diff --git a/samples/1_Utils/hipBusBandwidth/Makefile b/samples/1_Utils/hipBusBandwidth/Makefile index 4599cacba2..418f25f8ed 100644 --- a/samples/1_Utils/hipBusBandwidth/Makefile +++ b/samples/1_Utils/hipBusBandwidth/Makefile @@ -1,4 +1,7 @@ -HIP_PATH?=../../.. +HIP_PATH?= $(wildcard /opt/rocm/hip) +ifeq (,$(HIP_PATH)) + HIP_PATH=../../.. +endif HIPCC=$(HIP_PATH)/bin/hipcc EXE=hipBusBandwidth diff --git a/samples/1_Utils/hipDispatchLatency/Makefile b/samples/1_Utils/hipDispatchLatency/Makefile index 87e707923d..387cb9aac6 100644 --- a/samples/1_Utils/hipDispatchLatency/Makefile +++ b/samples/1_Utils/hipDispatchLatency/Makefile @@ -1,4 +1,7 @@ -HIP_PATH?=../../.. +HIP_PATH?= $(wildcard /opt/rocm/hip) +ifeq (,$(HIP_PATH)) + HIP_PATH=../../.. +endif HIPCC=$(HIP_PATH)/bin/hipcc EXE=hipDispatchLatency diff --git a/samples/1_Utils/hipInfo/Makefile b/samples/1_Utils/hipInfo/Makefile index d69067388e..53bad55e45 100644 --- a/samples/1_Utils/hipInfo/Makefile +++ b/samples/1_Utils/hipInfo/Makefile @@ -1,4 +1,7 @@ -HIP_PATH?=../../.. +HIP_PATH?= $(wildcard /opt/rocm/hip) +ifeq (,$(HIP_PATH)) + HIP_PATH=../../.. +endif HIPCC=$(HIP_PATH)/bin/hipcc EXE=hipInfo From 4bdbc7c5b60cdc43b6911de42eaf6a01c527c0e5 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Mon, 18 Apr 2016 12:34:36 +0530 Subject: [PATCH 51/82] Update README.md Some cosmetic changes --- README.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 39c1092c63..0262debc9f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Key features include: New projects can be developed directly in the portable HIP C++ language and can run on either NVIDIA or AMD platforms. Additionally, HIP provides porting tools which make it easy to port existing CUDA codes to the HIP layer, with no loss of performance as compared to the original CUDA application. HIP is not intended to be a drop-in replacement for CUDA, and developers should expect to do some manual coding and performance tuning work to complete the port. ## Installation -``` +```shell cd HIP-privatestaging mkdir build cd build @@ -50,12 +50,10 @@ HIP code can be developed either on AMD ROCm platform using hcc compiler, or a C * Install CUDA SDK from manufacturer website * By default HIP looks for CUDA SDK in /usr/local/cuda (can be overriden by setting CUDA_PATH env variable) -``` - #### Verify your installation Run hipconfig (instructions below assume default installation path) : -``` -> /opt/rocm/bin/hipconfig --full +```shell +/opt/rocm/bin/hipconfig --full ``` Compile and run the [square sample](https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/tree/master/samples/0_Intro/square). @@ -74,31 +72,31 @@ Also this [blog](http://gpuopen.com/getting-up-to-speed-with-the-codexl-gpu-prof and visualization tools, CodeXL also comes with an SDK that allow applications to add markers to the timeline viewer. We'll be linking HIP against this library. 2. Set CODEXL_PATH -``` +```shell # set to your code-xl installation location: export CODEXL_PATH=/opt/AMD/CodeXL ``` 3. Enable in source code. In src/hip_hcc.cpp, enable the define -``` +```c #define COMPILE_TRACE_MARKER 1 ``` Then recompile the target application, run with profiler enabled to generate ATP file or trace log. -``` +```shell # Use profiler to generate timeline view: -$ $CODEXL_PATH/CodeXLGpuProfiler -A -o ./myHipApp +$CODEXL_PATH/CodeXLGpuProfiler -A -o ./myHipApp ... Session output path: /home/me/HIP-privatestaging/tests/b1/mytrace.atp ``` You can also print the HIP function strings to stderr using HIP_TRACE_API environment variable. This can be useful for tracing application flow. Also can be combined with the more detailed debug information provided by the HIP_DB switch. For example: -``` +```shell # Trace to stderr showing begin/end of each function (with arguments) + intermediate debug trace during the execution of each function. -$ HIP_TRACE_API=1 HIP_DB=0x2 ./myHipApp +HIP_TRACE_API=1 HIP_DB=0x2 ./myHipApp ``` Note this trace mode uses colors. "less -r" can handle raw control characters and will display the debug output in proper colors. @@ -115,7 +113,8 @@ Here's how to use it with HIP: > (In the make step for HCC, we recommend setting -DCMAKE_INSTALL_PREFIX=/opt/hcc-native) Set HCC_HOME environment variable before compiling HIP program to point to the native compiler: -> export HCC_HOME=/opt/hcc-native +```shell +export HCC_HOME=/opt/hcc-native ``` ## Examples and Getting Started: @@ -124,14 +123,14 @@ Set HCC_HOME environment variable before compiling HIP program to point to the n ```shell -> cd samples/01_Intro/square +cd samples/01_Intro/square # follow README / blog steps to hipify the application. ``` * A sample and [blog](http://gpuopen.com/platform-aware-coding-inside-hip/) demonstrating platform specialization: ```shell -> cd samples/01_Intro/bit_extract -> make +cd samples/01_Intro/bit_extract +make ``` * Guide to [Porting a New Cuda Project](docs/markdown/hip_porting_guide.md#porting-a-new-cuda-project" aria-hidden="true">"]/$1/; - $countIncludes += s/(\s*#\s*include\s+)[<"]cuda_runtime_api\.h[>"]/$1/; + $countIncludes += s/(\s*#\s*include\s+)[<"]cuda_runtime\.h[>"]/$1/; + $countIncludes += s/(\s*#\s*include\s+)[<"]cuda_runtime_api\.h[>"]/$1/; #-------- @@ -559,7 +559,7 @@ while (@ARGV) { # If this file makes kernel builtin calls, and does not include the cuda_runtime.h, # then add an #include to match "magic" includes provided by NVCC. # This logic can miss cases where cuda_runtime.h is included by another include file. - print $OUTFILE '#include "hip_runtime.h"' . ($is_dos ? "\r\n" : "\n"); + print $OUTFILE '#include "hip/hip_runtime.h"' . ($is_dos ? "\r\n" : "\n"); } print $OUTFILE "$_"; } diff --git a/include/hcc_detail/hcc_acc.h b/include/hcc_detail/hcc_acc.h index c66b340579..d0d605d1c9 100644 --- a/include/hcc_detail/hcc_acc.h +++ b/include/hcc_detail/hcc_acc.h @@ -1,6 +1,6 @@ #ifndef HCC_ACC_H #define HCC_ACC_H -#include "hip_runtime_api.h" +#include "hip/hip_runtime_api.h" #if __cplusplus #ifdef __HCC__ diff --git a/include/hcc_detail/hip_hcc.h b/include/hcc_detail/hip_hcc.h index deb9fd0b04..4b40a0ac5e 100644 --- a/include/hcc_detail/hip_hcc.h +++ b/include/hcc_detail/hip_hcc.h @@ -21,8 +21,8 @@ THE SOFTWARE. #define HIP_HCC_H #include -#include "hcc_detail/hip_util.h" -#include "hcc_detail/staging_buffer.h" +#include "hip/hcc_detail/hip_util.h" +#include "hip/hcc_detail/staging_buffer.h" #define HIP_HCC diff --git a/include/hcc_detail/hip_runtime.h b/include/hcc_detail/hip_runtime.h index aa420e992d..e8dabb8bf7 100644 --- a/include/hcc_detail/hip_runtime.h +++ b/include/hcc_detail/hip_runtime.h @@ -40,8 +40,8 @@ THE SOFTWARE. #define CUDA_SUCCESS hipSuccess -#include -//#include "hcc_detail/hip_hcc.h" +#include +//#include "hip/hcc_detail/hip_hcc.h" //--- // Remainder of this file only compiles with HCC #ifdef __HCC__ @@ -55,9 +55,9 @@ extern int HIP_TRACE_API; //typedef grid_launch_parm hipLaunchParm ; #define hipLaunchParm grid_launch_parm #ifdef __cplusplus -#include +#include #endif -#include +#include // TODO-HCC remove old definitions ; ~1602 hcc supports __HCC_ACCELERATOR__ define. #if defined (__KALMAR_ACCELERATOR__) && !defined (__HCC_ACCELERATOR__) #define __HCC_ACCELERATOR__ __KALMAR_ACCELERATOR__ diff --git a/include/hcc_detail/hip_runtime_api.h b/include/hcc_detail/hip_runtime_api.h index 79eb369e48..b00360756a 100644 --- a/include/hcc_detail/hip_runtime_api.h +++ b/include/hcc_detail/hip_runtime_api.h @@ -30,9 +30,9 @@ THE SOFTWARE. #include #include -#include -#include -//#include "hip_hcc.h" +#include +#include +//#include "hip/hip_hcc.h" #if defined (__HCC__) && (__hcc_workweek__ < 16155) #error("This version of HIP requires a newer version of HCC."); diff --git a/include/hcc_detail/hip_texture.h b/include/hcc_detail/hip_texture.h index 53a6acf2bf..d4c3403ccf 100644 --- a/include/hcc_detail/hip_texture.h +++ b/include/hcc_detail/hip_texture.h @@ -32,7 +32,7 @@ THE SOFTWARE. #include -#include +#include //---- //Texture - TODO - likely need to move this to a separate file only included with kernel compilation. diff --git a/include/hip_runtime.h b/include/hip_runtime.h index 61a02cb3ea..dff1e19252 100644 --- a/include/hip_runtime.h +++ b/include/hip_runtime.h @@ -48,17 +48,17 @@ THE SOFTWARE. #endif -#include +#include #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__) -#include +#include #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__) -#include +#include #else #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__"); #endif -#include -#include +#include +#include diff --git a/include/hip_runtime_api.h b/include/hip_runtime_api.h index ca49ab5d13..cfb14c816d 100644 --- a/include/hip_runtime_api.h +++ b/include/hip_runtime_api.h @@ -30,7 +30,7 @@ THE SOFTWARE. #include // for getDeviceProp -#include +#include typedef struct { // 32-bit Atomics @@ -200,9 +200,9 @@ typedef enum hipDeviceAttribute_t { */ #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__) -#include "hcc_detail/hip_runtime_api.h" +#include "hip/hcc_detail/hip_runtime_api.h" #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__) -#include "nvcc_detail/hip_runtime_api.h" +#include "hip/nvcc_detail/hip_runtime_api.h" #else #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__"); #endif diff --git a/include/hip_vector_types.h b/include/hip_vector_types.h index 64702b8655..16b64e40bf 100644 --- a/include/hip_vector_types.h +++ b/include/hip_vector_types.h @@ -23,12 +23,12 @@ THE SOFTWARE. #pragma once -#include +#include #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__) #if __cplusplus -#include +#include #endif #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__) #include diff --git a/include/nvcc_detail/hip_runtime.h b/include/nvcc_detail/hip_runtime.h index 48f29518c9..cb1253fdf1 100644 --- a/include/nvcc_detail/hip_runtime.h +++ b/include/nvcc_detail/hip_runtime.h @@ -23,7 +23,7 @@ THE SOFTWARE. #include -#include +#include #define HIP_KERNEL_NAME(...) __VA_ARGS__ From 8c97a258de616be72d4e0a03a66f324cd971afa9 Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Tue, 19 Apr 2016 11:29:29 -0500 Subject: [PATCH 59/82] Set chicken bits to 0. --- src/hip_hcc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hip_hcc.cpp b/src/hip_hcc.cpp index 41469c5ee1..90f5afa929 100644 --- a/src/hip_hcc.cpp +++ b/src/hip_hcc.cpp @@ -70,8 +70,8 @@ int HIP_VISIBLE_DEVICES = 0; /* Contains a comma-separated sequence of GPU ident //--- // Chicken bits for disabling functionality to work around potential issues: -int HIP_DISABLE_HW_KERNEL_DEP = 1; -int HIP_DISABLE_HW_COPY_DEP = 1; +int HIP_DISABLE_HW_KERNEL_DEP = 0; +int HIP_DISABLE_HW_COPY_DEP = 0; thread_local int tls_defaultDevice = 0; thread_local hipError_t tls_lastHipError = hipSuccess; From 453615ed5768437113219a868b73709fa91845aa Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Tue, 19 Apr 2016 11:46:01 -0500 Subject: [PATCH 60/82] Fix hipDeviceReset synchronization --- include/hcc_detail/hip_hcc.h | 3 +++ src/hip_hcc.cpp | 34 +++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/include/hcc_detail/hip_hcc.h b/include/hcc_detail/hip_hcc.h index 4b40a0ac5e..99cc46c380 100644 --- a/include/hcc_detail/hip_hcc.h +++ b/include/hcc_detail/hip_hcc.h @@ -531,6 +531,9 @@ public: bool removePeer(ihipDevice_t *peer); void resetPeers(ihipDevice_t *thisDevice); + + void addStream(ihipStream_t *stream); + uint32_t peerCnt() const { return _peerCnt; }; hsa_agent_t *peerAgents() const { return _peerAgents; }; diff --git a/src/hip_hcc.cpp b/src/hip_hcc.cpp index 90f5afa929..44c9bb2807 100644 --- a/src/hip_hcc.cpp +++ b/src/hip_hcc.cpp @@ -249,6 +249,14 @@ void ihipDeviceCriticalBase_t::resetPeers(ihipDevice_t *thisDevice) addPeer(thisDevice); // peer-list always contains self agent. } + +template<> +void ihipDeviceCriticalBase_t::addStream(ihipStream_t *stream) +{ + _streams.push_back(stream); + stream->_id = incStreamId(); +} + //------------------------------------------------------------------------------------------------- //--- @@ -450,9 +458,29 @@ void ihipDevice_t::locked_reset() // Obtain mutex access to the device critical data, release by destructor LockedAccessor_DeviceCrit_t crit(_criticalData); + + //--- + //Wait for pending activity to complete? TODO - check if this is required behavior: + tprintf(DB_SYNC, "locked_reset waiting for activity to complete.\n"); + // Reset and remove streams: + // Delete all created streams including the default one. + for (auto streamI=crit->const_streams().begin(); streamI!=crit->const_streams().end(); streamI++) { + ihipStream_t *stream = *streamI; + (*streamI)->locked_wait(); + tprintf(DB_SYNC, " delete stream=%p\n", stream); + + delete stream; + } + // Clear the list. crit->streams().clear(); + + // Create a fresh default stream and add it: + _default_stream = new ihipStream_t(_device_index, _acc.get_default_view(), hipStreamDefault); + crit->addStream(_default_stream); + + // This resest peer list to just me: crit->resetPeers(this); @@ -488,9 +516,6 @@ void ihipDevice_t::init(unsigned device_index, unsigned deviceCnt, hc::accelerat locked_reset(); - _default_stream = new ihipStream_t(device_index, acc.get_default_view(), hipStreamDefault); - locked_addStream(_default_stream); - tprintf(DB_SYNC, "created device with default_stream=%p\n", _default_stream); @@ -772,8 +797,7 @@ void ihipDevice_t::locked_addStream(ihipStream_t *s) { LockedAccessor_DeviceCrit_t crit(_criticalData); - crit->streams().push_back(s); - s->_id = crit->incStreamId(); + crit->addStream(s); } //--- From 148799a37167861538509cf741f78aae77cb923a Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Tue, 19 Apr 2016 11:55:42 -0500 Subject: [PATCH 61/82] build hipHostRegister but dont run it --- tests/src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/CMakeLists.txt b/tests/src/CMakeLists.txt index cec6cf52e3..44d32c544b 100644 --- a/tests/src/CMakeLists.txt +++ b/tests/src/CMakeLists.txt @@ -167,7 +167,7 @@ make_hip_executable (hipHostAlloc hipHostAlloc.cpp) make_hip_executable (hipStreamL5 hipStreamL5.cpp) make_hip_executable (hipHostGetFlags hipHostGetFlags.cpp) #TODO - re-enable. This requires working hipHostRegister call, waiting on HCC feature. -#make_hip_executable (hipHostRegister hipHostRegister.cpp) +make_hip_executable (hipHostRegister hipHostRegister.cpp) make_hip_executable (hipRandomMemcpyAsync hipRandomMemcpyAsync.cpp) make_hip_executable (hipMemoryAllocate hipMemoryAllocate.cpp) make_hip_executable (hipFuncSetDeviceFlags hipFuncSetDeviceFlags.cpp) @@ -209,7 +209,7 @@ make_test(hipHostAlloc " ") # BS- comment out since test appears broken - asks for device pointer but pointer was never allocated. #make_test(hipHostGetFlags " ") make_test(hipHcc " " ) -make_test(hipHostRegister " ") +#make_test(hipHostRegister " ") make_test(hipStreamL5 " ") make_test(hipRandomMemcpyAsync " ") #make_test(hipAPIStreamEnable " ") From 26c6f9f8619c06c0a591ff5e88ad20a39dc0e114 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Tue, 19 Apr 2016 22:44:58 +0530 Subject: [PATCH 62/82] Update doxygen documentation --- docs/RuntimeAPI/html/Synchonization.html | 2 +- docs/RuntimeAPI/html/annotated.html | 2 +- docs/RuntimeAPI/html/bug.html | 2 +- .../html/classFakeMutex-members.html | 2 +- docs/RuntimeAPI/html/classFakeMutex.html | 4 +- .../html/classLockedAccessor-members.html | 2 +- docs/RuntimeAPI/html/classLockedAccessor.html | 4 +- docs/RuntimeAPI/html/classes.html | 2 +- ...lassihipDeviceCriticalBase__t-members.html | 29 +- .../html/classihipDeviceCriticalBase__t.html | 7 +- .../html/classihipDevice__t-members.html | 2 +- docs/RuntimeAPI/html/classihipDevice__t.html | 6 +- .../html/classihipException-members.html | 2 +- docs/RuntimeAPI/html/classihipException.html | 4 +- ...lassihipStreamCriticalBase__t-members.html | 2 +- .../html/classihipStreamCriticalBase__t.html | 4 +- .../html/classihipStream__t-members.html | 2 +- docs/RuntimeAPI/html/classihipStream__t.html | 6 +- .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 4 +- .../dir_6d8604cb65fa6b83549668eb0ce09cac.html | 4 +- .../dir_d44c64559bbebec7f509842c48db8b23.html | 4 +- docs/RuntimeAPI/html/files.html | 2 +- docs/RuntimeAPI/html/functions.html | 2 +- docs/RuntimeAPI/html/functions_vars.html | 2 +- docs/RuntimeAPI/html/globals.html | 2 +- docs/RuntimeAPI/html/globals_defs.html | 2 +- docs/RuntimeAPI/html/globals_enum.html | 2 +- docs/RuntimeAPI/html/globals_eval.html | 2 +- docs/RuntimeAPI/html/globals_func.html | 2 +- docs/RuntimeAPI/html/globals_type.html | 2 +- docs/RuntimeAPI/html/group__API.html | 2 +- docs/RuntimeAPI/html/group__Device.html | 2 +- docs/RuntimeAPI/html/group__Error.html | 2 +- docs/RuntimeAPI/html/group__Event.html | 2 +- docs/RuntimeAPI/html/group__GlobalDefs.html | 2 +- .../RuntimeAPI/html/group__HCC__Specific.html | 2 +- docs/RuntimeAPI/html/group__HIP-ENV.html | 2 +- docs/RuntimeAPI/html/group__Memory.html | 2 +- docs/RuntimeAPI/html/group__PeerToPeer.html | 2 +- docs/RuntimeAPI/html/group__Profiler.html | 2 +- docs/RuntimeAPI/html/group__Stream.html | 2 +- docs/RuntimeAPI/html/group__Texture.html | 2 +- docs/RuntimeAPI/html/group__Version.html | 2 +- docs/RuntimeAPI/html/hcc_8h_source.html | 4 +- docs/RuntimeAPI/html/hcc__acc_8h_source.html | 11 +- .../html/hcc__detail_2hip__runtime_8h.html | 8 +- .../hcc__detail_2hip__runtime_8h_source.html | 15 +- .../hcc__detail_2hip__runtime__api_8h.html | 8 +- ...__detail_2hip__runtime__api_8h_source.html | 12 +- .../hcc__detail_2hip__vector__types_8h.html | 4 +- ..._detail_2hip__vector__types_8h_source.html | 4 +- docs/RuntimeAPI/html/hierarchy.html | 2 +- .../html/hip__common_8h_source.html | 4 +- docs/RuntimeAPI/html/hip__hcc_8cpp.html | 8 +- docs/RuntimeAPI/html/hip__hcc_8h_source.html | 315 +++++++++--------- .../html/hip__runtime_8h_source.html | 17 +- .../html/hip__runtime__api_8h_source.html | 11 +- docs/RuntimeAPI/html/hip__texture_8h.html | 6 +- .../html/hip__texture_8h_source.html | 7 +- docs/RuntimeAPI/html/hip__util_8h_source.html | 4 +- .../html/hip__vector__types_8h_source.html | 9 +- docs/RuntimeAPI/html/host__defines_8h.html | 4 +- .../html/host__defines_8h_source.html | 4 +- docs/RuntimeAPI/html/index.html | 2 +- docs/RuntimeAPI/html/modules.html | 2 +- docs/RuntimeAPI/html/pages.html | 2 +- .../html/staging__buffer_8h_source.html | 4 +- .../html/structLockedBase-members.html | 2 +- docs/RuntimeAPI/html/structLockedBase.html | 4 +- .../html/structStagingBuffer-members.html | 2 +- docs/RuntimeAPI/html/structStagingBuffer.html | 6 +- docs/RuntimeAPI/html/structdim3-members.html | 2 +- docs/RuntimeAPI/html/structdim3.html | 4 +- .../structhipChannelFormatDesc-members.html | 2 +- .../html/structhipChannelFormatDesc.html | 4 +- .../html/structhipDeviceArch__t-members.html | 2 +- .../html/structhipDeviceArch__t.html | 4 +- .../html/structhipDeviceProp__t-members.html | 2 +- .../html/structhipDeviceProp__t.html | 4 +- .../html/structhipEvent__t-members.html | 2 +- docs/RuntimeAPI/html/structhipEvent__t.html | 4 +- .../structhipPointerAttribute__t-members.html | 2 +- .../html/structhipPointerAttribute__t.html | 4 +- .../html/structihipEvent__t-members.html | 2 +- docs/RuntimeAPI/html/structihipEvent__t.html | 4 +- .../html/structihipSignal__t-members.html | 2 +- docs/RuntimeAPI/html/structihipSignal__t.html | 6 +- .../html/structtextureReference-members.html | 2 +- .../html/structtextureReference.html | 4 +- .../html/trace__helper_8h_source.html | 4 +- 90 files changed, 338 insertions(+), 343 deletions(-) diff --git a/docs/RuntimeAPI/html/Synchonization.html b/docs/RuntimeAPI/html/Synchonization.html index 198f1d8d55..05c16aa272 100644 --- a/docs/RuntimeAPI/html/Synchonization.html +++ b/docs/RuntimeAPI/html/Synchonization.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/annotated.html b/docs/RuntimeAPI/html/annotated.html index 7aad966bcb..1e46ddb367 100644 --- a/docs/RuntimeAPI/html/annotated.html +++ b/docs/RuntimeAPI/html/annotated.html @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/bug.html b/docs/RuntimeAPI/html/bug.html index b017f3a1b0..d263a9da5e 100644 --- a/docs/RuntimeAPI/html/bug.html +++ b/docs/RuntimeAPI/html/bug.html @@ -93,7 +93,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/classFakeMutex-members.html b/docs/RuntimeAPI/html/classFakeMutex-members.html index bd3173d921..93cef01e63 100644 --- a/docs/RuntimeAPI/html/classFakeMutex-members.html +++ b/docs/RuntimeAPI/html/classFakeMutex-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/classFakeMutex.html b/docs/RuntimeAPI/html/classFakeMutex.html index 99265880e5..ee6281bdcf 100644 --- a/docs/RuntimeAPI/html/classFakeMutex.html +++ b/docs/RuntimeAPI/html/classFakeMutex.html @@ -104,12 +104,12 @@ void unlock () 
                    The documentation for this class was generated from the following file:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    diff --git a/docs/RuntimeAPI/html/classLockedAccessor-members.html b/docs/RuntimeAPI/html/classLockedAccessor-members.html index 0440c28c7e..b28c517916 100644 --- a/docs/RuntimeAPI/html/classLockedAccessor-members.html +++ b/docs/RuntimeAPI/html/classLockedAccessor-members.html @@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/classLockedAccessor.html b/docs/RuntimeAPI/html/classLockedAccessor.html index 1712e382f9..198e041c75 100644 --- a/docs/RuntimeAPI/html/classLockedAccessor.html +++ b/docs/RuntimeAPI/html/classLockedAccessor.html @@ -104,12 +104,12 @@ T * operator-> () 
                    The documentation for this class was generated from the following file:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    diff --git a/docs/RuntimeAPI/html/classes.html b/docs/RuntimeAPI/html/classes.html index a36250a427..670a0c35d8 100644 --- a/docs/RuntimeAPI/html/classes.html +++ b/docs/RuntimeAPI/html/classes.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t-members.html b/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t-members.html index 02331c2b9e..cef393efa0 100644 --- a/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t-members.html +++ b/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t-members.html @@ -92,23 +92,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - - - - - - - - - - - - - + + + + + + + + + + + + + +
                    _mutex (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >private
                    addPeer(ihipDevice_t *peer) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >
                    const_streams() const (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    ihipDeviceCriticalBase_t() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    incStreamId() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    init(unsigned deviceCnt) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    lock() (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >inlineprivate
                    LockedAccessor< ihipDeviceCriticalBase_t > (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >friend
                    peerAgents() const (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    peerCnt() const (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    removePeer(ihipDevice_t *peer) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >
                    resetPeers(ihipDevice_t *thisDevice) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >
                    streams() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    unlock() (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >inlineprivate
                    ~ihipDeviceCriticalBase_t() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    addStream(ihipStream_t *stream) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >
                    const_streams() const (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    ihipDeviceCriticalBase_t() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    incStreamId() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    init(unsigned deviceCnt) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    lock() (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >inlineprivate
                    LockedAccessor< ihipDeviceCriticalBase_t > (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >friend
                    peerAgents() const (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    peerCnt() const (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    removePeer(ihipDevice_t *peer) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >
                    resetPeers(ihipDevice_t *thisDevice) (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >
                    streams() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    unlock() (defined in LockedBase< MUTEX_TYPE >)LockedBase< MUTEX_TYPE >inlineprivate
                    ~ihipDeviceCriticalBase_t() (defined in ihipDeviceCriticalBase_t< MUTEX_TYPE >)ihipDeviceCriticalBase_t< MUTEX_TYPE >inline
                    diff --git a/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.html b/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.html index 91ecb9dfe3..c3bbd18337 100644 --- a/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.html +++ b/docs/RuntimeAPI/html/classihipDeviceCriticalBase__t.html @@ -124,6 +124,9 @@ bool removePeer ( void resetPeers (ihipDevice_t *thisDevice)   + +void addStream (ihipStream_t *stream) +  uint32_t peerCnt () const   @@ -138,12 +141,12 @@ class LockedAccessor< i  
                    The documentation for this class was generated from the following file:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    diff --git a/docs/RuntimeAPI/html/classihipDevice__t-members.html b/docs/RuntimeAPI/html/classihipDevice__t-members.html index bc1a11bd75..abfe39aa93 100644 --- a/docs/RuntimeAPI/html/classihipDevice__t-members.html +++ b/docs/RuntimeAPI/html/classihipDevice__t-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/classihipDevice__t.html b/docs/RuntimeAPI/html/classihipDevice__t.html index 9f3ed0481d..c808706695 100644 --- a/docs/RuntimeAPI/html/classihipDevice__t.html +++ b/docs/RuntimeAPI/html/classihipDevice__t.html @@ -144,13 +144,13 @@ unsigned _device_flags  
                    The documentation for this class was generated from the following files:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • -
                    • /home/mangupta/hip_git/rel0.84.0/src/hip_hcc.cpp
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/src/hip_hcc.cpp
                    diff --git a/docs/RuntimeAPI/html/classihipException-members.html b/docs/RuntimeAPI/html/classihipException-members.html index 937af05387..16623c6191 100644 --- a/docs/RuntimeAPI/html/classihipException-members.html +++ b/docs/RuntimeAPI/html/classihipException-members.html @@ -95,7 +95,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/classihipException.html b/docs/RuntimeAPI/html/classihipException.html index 1e57d7e471..b882caa43f 100644 --- a/docs/RuntimeAPI/html/classihipException.html +++ b/docs/RuntimeAPI/html/classihipException.html @@ -113,12 +113,12 @@ Public Attributes  
                    The documentation for this class was generated from the following file:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    diff --git a/docs/RuntimeAPI/html/classihipStreamCriticalBase__t-members.html b/docs/RuntimeAPI/html/classihipStreamCriticalBase__t-members.html index 60f9c4996e..b8c648b0b6 100644 --- a/docs/RuntimeAPI/html/classihipStreamCriticalBase__t-members.html +++ b/docs/RuntimeAPI/html/classihipStreamCriticalBase__t-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/classihipStreamCriticalBase__t.html b/docs/RuntimeAPI/html/classihipStreamCriticalBase__t.html index 96f9d656fc..8d6d0cbdc0 100644 --- a/docs/RuntimeAPI/html/classihipStreamCriticalBase__t.html +++ b/docs/RuntimeAPI/html/classihipStreamCriticalBase__t.html @@ -144,12 +144,12 @@ MUTEX_TYPE _mutex  
                    The documentation for this class was generated from the following file:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    diff --git a/docs/RuntimeAPI/html/classihipStream__t-members.html b/docs/RuntimeAPI/html/classihipStream__t-members.html index 3a51df77a0..78a1c9e051 100644 --- a/docs/RuntimeAPI/html/classihipStream__t-members.html +++ b/docs/RuntimeAPI/html/classihipStream__t-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/classihipStream__t.html b/docs/RuntimeAPI/html/classihipStream__t.html index 3c101e9bc0..af8a80a26e 100644 --- a/docs/RuntimeAPI/html/classihipStream__t.html +++ b/docs/RuntimeAPI/html/classihipStream__t.html @@ -164,13 +164,13 @@ std::ostream & operato  
                    The documentation for this class was generated from the following files:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • -
                    • /home/mangupta/hip_git/rel0.84.0/src/hip_hcc.cpp
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/src/hip_hcc.cpp
                    diff --git a/docs/RuntimeAPI/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/RuntimeAPI/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html index 8ea47d84d0..e5899cfc4f 100644 --- a/docs/RuntimeAPI/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/docs/RuntimeAPI/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/src Directory Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/src Directory Reference @@ -108,7 +108,7 @@ Files diff --git a/docs/RuntimeAPI/html/dir_6d8604cb65fa6b83549668eb0ce09cac.html b/docs/RuntimeAPI/html/dir_6d8604cb65fa6b83549668eb0ce09cac.html index 818899bc59..01b2359943 100644 --- a/docs/RuntimeAPI/html/dir_6d8604cb65fa6b83549668eb0ce09cac.html +++ b/docs/RuntimeAPI/html/dir_6d8604cb65fa6b83549668eb0ce09cac.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail Directory Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail Directory Reference @@ -115,7 +115,7 @@ Files diff --git a/docs/RuntimeAPI/html/dir_d44c64559bbebec7f509842c48db8b23.html b/docs/RuntimeAPI/html/dir_d44c64559bbebec7f509842c48db8b23.html index 7a9bf94f64..540366d798 100644 --- a/docs/RuntimeAPI/html/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/docs/RuntimeAPI/html/dir_d44c64559bbebec7f509842c48db8b23.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include Directory Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include Directory Reference @@ -105,7 +105,7 @@ Files diff --git a/docs/RuntimeAPI/html/files.html b/docs/RuntimeAPI/html/files.html index 9c4227fd9d..6d6a5803cd 100644 --- a/docs/RuntimeAPI/html/files.html +++ b/docs/RuntimeAPI/html/files.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/functions.html b/docs/RuntimeAPI/html/functions.html index 2eabb218cc..f8cf987a05 100644 --- a/docs/RuntimeAPI/html/functions.html +++ b/docs/RuntimeAPI/html/functions.html @@ -309,7 +309,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/functions_vars.html b/docs/RuntimeAPI/html/functions_vars.html index 5dc919231f..f0369d18f3 100644 --- a/docs/RuntimeAPI/html/functions_vars.html +++ b/docs/RuntimeAPI/html/functions_vars.html @@ -309,7 +309,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals.html b/docs/RuntimeAPI/html/globals.html index 1e1f48fee6..d945f975ca 100644 --- a/docs/RuntimeAPI/html/globals.html +++ b/docs/RuntimeAPI/html/globals.html @@ -385,7 +385,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals_defs.html b/docs/RuntimeAPI/html/globals_defs.html index c98e741616..687f6b28ad 100644 --- a/docs/RuntimeAPI/html/globals_defs.html +++ b/docs/RuntimeAPI/html/globals_defs.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals_enum.html b/docs/RuntimeAPI/html/globals_enum.html index 21ee1800ad..4888f8c682 100644 --- a/docs/RuntimeAPI/html/globals_enum.html +++ b/docs/RuntimeAPI/html/globals_enum.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals_eval.html b/docs/RuntimeAPI/html/globals_eval.html index 8c8143077d..5739a6b30a 100644 --- a/docs/RuntimeAPI/html/globals_eval.html +++ b/docs/RuntimeAPI/html/globals_eval.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals_func.html b/docs/RuntimeAPI/html/globals_func.html index 66b5ca15dd..cbf0b639db 100644 --- a/docs/RuntimeAPI/html/globals_func.html +++ b/docs/RuntimeAPI/html/globals_func.html @@ -268,7 +268,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/globals_type.html b/docs/RuntimeAPI/html/globals_type.html index 7730e8d003..a5f674defa 100644 --- a/docs/RuntimeAPI/html/globals_type.html +++ b/docs/RuntimeAPI/html/globals_type.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/group__API.html b/docs/RuntimeAPI/html/group__API.html index 167a738125..f32b09b16b 100644 --- a/docs/RuntimeAPI/html/group__API.html +++ b/docs/RuntimeAPI/html/group__API.html @@ -110,7 +110,7 @@ Modules diff --git a/docs/RuntimeAPI/html/group__Device.html b/docs/RuntimeAPI/html/group__Device.html index c03607d6ed..b97f6c6b23 100644 --- a/docs/RuntimeAPI/html/group__Device.html +++ b/docs/RuntimeAPI/html/group__Device.html @@ -463,7 +463,7 @@ Functions diff --git a/docs/RuntimeAPI/html/group__Error.html b/docs/RuntimeAPI/html/group__Error.html index e877b2624f..6a01f21b81 100644 --- a/docs/RuntimeAPI/html/group__Error.html +++ b/docs/RuntimeAPI/html/group__Error.html @@ -197,7 +197,7 @@ Functions diff --git a/docs/RuntimeAPI/html/group__Event.html b/docs/RuntimeAPI/html/group__Event.html index c9756da0e4..f4f185dcac 100644 --- a/docs/RuntimeAPI/html/group__Event.html +++ b/docs/RuntimeAPI/html/group__Event.html @@ -340,7 +340,7 @@ Functions diff --git a/docs/RuntimeAPI/html/group__GlobalDefs.html b/docs/RuntimeAPI/html/group__GlobalDefs.html index dd2c898093..3cabc32dc3 100644 --- a/docs/RuntimeAPI/html/group__GlobalDefs.html +++ b/docs/RuntimeAPI/html/group__GlobalDefs.html @@ -623,7 +623,7 @@ Enumerations diff --git a/docs/RuntimeAPI/html/group__HCC__Specific.html b/docs/RuntimeAPI/html/group__HCC__Specific.html index 5ea57f348f..bb5dee0fdc 100644 --- a/docs/RuntimeAPI/html/group__HCC__Specific.html +++ b/docs/RuntimeAPI/html/group__HCC__Specific.html @@ -88,7 +88,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/group__HIP-ENV.html b/docs/RuntimeAPI/html/group__HIP-ENV.html index dacfb02ec3..7445752649 100644 --- a/docs/RuntimeAPI/html/group__HIP-ENV.html +++ b/docs/RuntimeAPI/html/group__HIP-ENV.html @@ -82,7 +82,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/group__Memory.html b/docs/RuntimeAPI/html/group__Memory.html index 85d0a0390f..7245bf2416 100644 --- a/docs/RuntimeAPI/html/group__Memory.html +++ b/docs/RuntimeAPI/html/group__Memory.html @@ -829,7 +829,7 @@ on HCC hipMemcpyAsync requires that any host pointers are pinned (ie via the hip diff --git a/docs/RuntimeAPI/html/group__PeerToPeer.html b/docs/RuntimeAPI/html/group__PeerToPeer.html index 68e2c12d3e..c737bc7bf4 100644 --- a/docs/RuntimeAPI/html/group__PeerToPeer.html +++ b/docs/RuntimeAPI/html/group__PeerToPeer.html @@ -337,7 +337,7 @@ Functions diff --git a/docs/RuntimeAPI/html/group__Profiler.html b/docs/RuntimeAPI/html/group__Profiler.html index c3f7a5a494..be90725871 100644 --- a/docs/RuntimeAPI/html/group__Profiler.html +++ b/docs/RuntimeAPI/html/group__Profiler.html @@ -85,7 +85,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/group__Stream.html b/docs/RuntimeAPI/html/group__Stream.html index 014c6a90e0..f3a4f40535 100644 --- a/docs/RuntimeAPI/html/group__Stream.html +++ b/docs/RuntimeAPI/html/group__Stream.html @@ -314,7 +314,7 @@ Functions diff --git a/docs/RuntimeAPI/html/group__Texture.html b/docs/RuntimeAPI/html/group__Texture.html index 0778a5319c..0142de0aaa 100644 --- a/docs/RuntimeAPI/html/group__Texture.html +++ b/docs/RuntimeAPI/html/group__Texture.html @@ -121,7 +121,7 @@ template<class T , int dim, enum hipTextureReadMode readMode> diff --git a/docs/RuntimeAPI/html/group__Version.html b/docs/RuntimeAPI/html/group__Version.html index 86b02f28a9..8c8a1ef101 100644 --- a/docs/RuntimeAPI/html/group__Version.html +++ b/docs/RuntimeAPI/html/group__Version.html @@ -114,7 +114,7 @@ Functions diff --git a/docs/RuntimeAPI/html/hcc_8h_source.html b/docs/RuntimeAPI/html/hcc_8h_source.html index 5b2a7aa240..287ff77891 100644 --- a/docs/RuntimeAPI/html/hcc_8h_source.html +++ b/docs/RuntimeAPI/html/hcc_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc.h Source File @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hcc__acc_8h_source.html b/docs/RuntimeAPI/html/hcc__acc_8h_source.html index 5ae15a291a..5c1b902cfe 100644 --- a/docs/RuntimeAPI/html/hcc__acc_8h_source.html +++ b/docs/RuntimeAPI/html/hcc__acc_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hcc_acc.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hcc_acc.h Source File @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    1 #ifndef HCC_ACC_H
                    2 #define HCC_ACC_H
                    -
                    3 #include "hip_runtime_api.h"
                    +
                    3 #include "hip/hip_runtime_api.h"
                    4 
                    5 #if __cplusplus
                    6 #ifdef __HCC__
                    @@ -103,14 +103,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    18 #endif
                    19 
                    20 #endif
                    -
                    hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc)
                    Definition: hip_hcc.cpp:1372
                    +
                    hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc)
                    Definition: hip_hcc.cpp:1396
                    hipError_t
                    Definition: hip_runtime_api.h:142
                    -
                    hipError_t hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av)
                    Definition: hip_hcc.cpp:1392
                    -
                    Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
                    +
                    hipError_t hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av)
                    Definition: hip_hcc.cpp:1416
                    diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h.html b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h.html index 950a3befde..3512236a26 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_runtime.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_runtime.h File Reference @@ -98,9 +98,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); More...

                    #include <string.h>
                    #include <stddef.h>
                    -#include <hip_runtime_api.h>
                    +#include <hip/hip_runtime_api.h>
                    #include <grid_launch.h>
                    -#include <hcc_detail/host_defines.h>
                    +#include <hip/hcc_detail/host_defines.h>

                    Go to the source code of this file.

                    @@ -197,7 +197,7 @@ const int  diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h_source.html b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h_source.html index 1ebb8604cd..17f164c7e0 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h_source.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_runtime.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_runtime.h Source File @@ -126,8 +126,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    40 
                    41 #define CUDA_SUCCESS hipSuccess
                    42 
                    -
                    43 #include <hip_runtime_api.h>
                    -
                    44 //#include "hcc_detail/hip_hcc.h"
                    +
                    43 #include <hip/hip_runtime_api.h>
                    +
                    44 //#include "hip/hcc_detail/hip_hcc.h"
                    45 //---
                    46 // Remainder of this file only compiles with HCC
                    47 #ifdef __HCC__
                    @@ -141,9 +141,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    55 //typedef grid_launch_parm hipLaunchParm ;
                    56 #define hipLaunchParm grid_launch_parm
                    57 #ifdef __cplusplus
                    -
                    58 #include <hcc_detail/hip_texture.h>
                    +
                    58 #include <hip/hcc_detail/hip_texture.h>
                    59 #endif
                    - +
                    60 #include <hip/hcc_detail/host_defines.h>
                    61 // TODO-HCC remove old definitions ; ~1602 hcc supports __HCC_ACCELERATOR__ define.
                    62 #if defined (__KALMAR_ACCELERATOR__) && !defined (__HCC_ACCELERATOR__)
                    63 #define __HCC_ACCELERATOR__ __KALMAR_ACCELERATOR__
                    @@ -646,14 +646,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    567 
                    573 // End doxygen API:
                    579 #endif
                    -
                    TODO-doc.
                    #define __host__
                    Definition: host_defines.h:35
                    -
                    HIP C++ Texture API for hcc compiler.
                    -
                    Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
                    diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h.html b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h.html index a8fc9f8a60..67633ce1de 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_runtime_api.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_runtime_api.h File Reference @@ -100,8 +100,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); More...

                    #include <stdint.h>
                    #include <stddef.h>
                    -#include <hcc_detail/host_defines.h>
                    -#include <hip_runtime_api.h>
                    +#include <hip/hcc_detail/host_defines.h>
                    +#include <hip/hip_runtime_api.h>

                    Go to the source code of this file.

                    warpSize
                    @@ -392,7 +392,7 @@ Functions diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h_source.html b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h_source.html index 51e0670d7f..b62d900793 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h_source.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__runtime__api_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_runtime_api.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_runtime_api.h Source File @@ -117,9 +117,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    30 #include <stdint.h>
                    31 #include <stddef.h>
                    32 
                    - -
                    34 #include <hip_runtime_api.h>
                    -
                    35 //#include "hip_hcc.h"
                    +
                    33 #include <hip/hcc_detail/host_defines.h>
                    +
                    34 #include <hip/hip_runtime_api.h>
                    +
                    35 //#include "hip/hip_hcc.h"
                    36 
                    37 #if defined (__HCC__) && (__hcc_workweek__ < 16155)
                    38 #error("This version of HIP requires a newer version of HCC.");
                    @@ -411,7 +411,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    hipError_t hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream)
                    Copy data from src to dst asynchronously.
                    Definition: hip_memory.cpp:343
                    hipError_t hipPeekAtLastError(void)
                    Return last error returned by any HIP runtime API call.
                    struct dim3 dim3
                    -
                    TODO-doc.
                    hipError_t hipGetDeviceProperties(hipDeviceProp_t *prop, int device)
                    Returns device properties.
                    Definition: hip_device.cpp:267
                    hipError_t hipMemcpyToSymbol(const char *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind)
                    Copies sizeBytes bytes from the memory area pointed to by src to the memory area pointed to by offset...
                    Definition: hip_memory.cpp:291
                    hipError_t hipFuncSetCacheConfig(hipFuncCache config)
                    Set Cache configuration for a specific function.
                    Definition: hip_device.cpp:90
                    @@ -478,7 +477,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    Definition: hip_hcc.h:399
                    hipError_t hipMemcpyPeer(void *dst, int dstDeviceId, const void *src, int srcDeviceId, size_t sizeBytes)
                    Copies memory from one device to memory on another device.
                    Definition: hip_peer.cpp:131
                    hipError_t hipStreamCreate(hipStream_t *stream)
                    Create an asynchronous stream.
                    Definition: hip_stream.cpp:63
                    -
                    Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
                    hipError_t hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind)
                    Copy data from src to dst.
                    Definition: hip_memory.cpp:312
                    hipError_t hipEventCreate(hipEvent_t *event)
                    Definition: hip_event.cpp:61
                    hipError_t hipFreeHost(void *ptr) __attribute__((deprecated("use hipHostFree instead")))
                    Free memory allocated by the hcc hip host memory allocation API.
                    Definition: hip_memory.cpp:513
                    @@ -492,7 +490,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h.html b/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h.html index ebed2f5949..1750bed328 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_vector_types.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_vector_types.h File Reference @@ -443,7 +443,7 @@ Functions diff --git a/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h_source.html b/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h_source.html index ef5a671084..c19ef2c17b 100644 --- a/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h_source.html +++ b/docs/RuntimeAPI/html/hcc__detail_2hip__vector__types_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_vector_types.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_vector_types.h Source File @@ -291,7 +291,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hierarchy.html b/docs/RuntimeAPI/html/hierarchy.html index 098a24842c..10dfb72c2e 100644 --- a/docs/RuntimeAPI/html/hierarchy.html +++ b/docs/RuntimeAPI/html/hierarchy.html @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hip__common_8h_source.html b/docs/RuntimeAPI/html/hip__common_8h_source.html index d0c7252e3a..b2940a5a45 100644 --- a/docs/RuntimeAPI/html/hip__common_8h_source.html +++ b/docs/RuntimeAPI/html/hip__common_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hip_common.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hip_common.h Source File @@ -181,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hip__hcc_8cpp.html b/docs/RuntimeAPI/html/hip__hcc_8cpp.html index e009208110..2243e52457 100644 --- a/docs/RuntimeAPI/html/hip__hcc_8cpp.html +++ b/docs/RuntimeAPI/html/hip__hcc_8cpp.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/src/hip_hcc.cpp File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/src/hip_hcc.cpp File Reference @@ -203,10 +203,10 @@ int  +int  +int  @@ -335,7 +335,7 @@ hsa_agent_t 
                    HIP_STREAM_SIGNALS int HIP_VISIBLE_DEVICES = 0
                     
                    -int HIP_DISABLE_HW_KERNEL_DEP = 1
                    HIP_DISABLE_HW_KERNEL_DEP = 0
                     
                    -int HIP_DISABLE_HW_COPY_DEP = 1
                    HIP_DISABLE_HW_COPY_DEP = 0
                     
                    thread_local int tls_defaultDevice = 0
                    g_cpu_agent diff --git a/docs/RuntimeAPI/html/hip__hcc_8h_source.html b/docs/RuntimeAPI/html/hip__hcc_8h_source.html index 55c1a023fa..d8fac6f79f 100644 --- a/docs/RuntimeAPI/html/hip__hcc_8h_source.html +++ b/docs/RuntimeAPI/html/hip__hcc_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h Source File @@ -112,8 +112,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    21 #define HIP_HCC_H
                    22 
                    23 #include <hc.hpp>
                    -
                    24 #include "hcc_detail/hip_util.h"
                    -
                    25 #include "hcc_detail/staging_buffer.h"
                    +
                    24 #include "hip/hcc_detail/hip_util.h"
                    +
                    25 #include "hip/hcc_detail/staging_buffer.h"
                    26 
                    27 #define HIP_HCC
                    28 
                    @@ -622,175 +622,178 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    531  bool removePeer(ihipDevice_t *peer);
                    532  void resetPeers(ihipDevice_t *thisDevice);
                    533 
                    -
                    534  uint32_t peerCnt() const { return _peerCnt; };
                    -
                    535  hsa_agent_t *peerAgents() const { return _peerAgents; };
                    +
                    534 
                    +
                    535  void addStream(ihipStream_t *stream);
                    536 
                    -
                    537 
                    -
                    538 private:
                    -
                    539  std::list<ihipStream_t*> _streams; // streams associated with this device.
                    -
                    540  ihipStream_t::SeqNum_t _stream_id;
                    -
                    541 
                    -
                    542  // These reflect the currently Enabled set of peers for this GPU:
                    -
                    543  std::list<ihipDevice_t*> _peers; // list of enabled peer devices.
                    -
                    544  uint32_t _peerCnt; // number of enabled peers
                    -
                    545  hsa_agent_t *_peerAgents; // efficient packed array of enabled agents (to use for allocations.)
                    -
                    546 private:
                    -
                    547  void recomputePeerAgents();
                    -
                    548 };
                    -
                    549 
                    -
                    550 // Note Mutex selected based on DeviceMutex
                    - +
                    537  uint32_t peerCnt() const { return _peerCnt; };
                    +
                    538  hsa_agent_t *peerAgents() const { return _peerAgents; };
                    +
                    539 
                    +
                    540 
                    +
                    541 private:
                    +
                    542  std::list<ihipStream_t*> _streams; // streams associated with this device.
                    +
                    543  ihipStream_t::SeqNum_t _stream_id;
                    +
                    544 
                    +
                    545  // These reflect the currently Enabled set of peers for this GPU:
                    +
                    546  std::list<ihipDevice_t*> _peers; // list of enabled peer devices.
                    +
                    547  uint32_t _peerCnt; // number of enabled peers
                    +
                    548  hsa_agent_t *_peerAgents; // efficient packed array of enabled agents (to use for allocations.)
                    +
                    549 private:
                    +
                    550  void recomputePeerAgents();
                    +
                    551 };
                    552 
                    -
                    553 // This type is used by functions that need access to the critical device structures.
                    - +
                    553 // Note Mutex selected based on DeviceMutex
                    +
                    555 
                    -
                    556 
                    -
                    557 
                    -
                    558 //-------------------------------------------------------------------------------------------------
                    -
                    559 // Functions which read or write the critical data are named locked_.
                    -
                    560 // ihipDevice_t does not use recursive locks so the ihip implementation must avoid calling a locked_ function from within a locked_ function.
                    -
                    561 // External functions which call several locked_ functions will acquire and release the lock for each function. if this occurs in
                    -
                    562 // performance-sensitive code we may want to refactor by adding non-locked functions and creating a new locked_ member function to call them all.
                    - -
                    564 {
                    -
                    565 public: // Functions:
                    -
                    566  ihipDevice_t() {}; // note: calls constructor for _criticalData
                    -
                    567  void init(unsigned device_index, unsigned deviceCnt, hc::accelerator &acc, unsigned flags);
                    -
                    568  ~ihipDevice_t();
                    -
                    569 
                    -
                    570  void locked_addStream(ihipStream_t *s);
                    -
                    571  void locked_removeStream(ihipStream_t *s);
                    -
                    572  void locked_reset();
                    -
                    573  void locked_waitAllStreams();
                    -
                    574  void locked_syncDefaultStream(bool waitOnSelf);
                    -
                    575 
                    -
                    576  ihipDeviceCritical_t &criticalData() { return _criticalData; }; // TODO, move private. Fix P2P.
                    -
                    577 
                    -
                    578 public: // Data, set at initialization:
                    -
                    579  unsigned _device_index; // index into g_devices.
                    +
                    556 // This type is used by functions that need access to the critical device structures.
                    + +
                    558 
                    +
                    559 
                    +
                    560 
                    +
                    561 //-------------------------------------------------------------------------------------------------
                    +
                    562 // Functions which read or write the critical data are named locked_.
                    +
                    563 // ihipDevice_t does not use recursive locks so the ihip implementation must avoid calling a locked_ function from within a locked_ function.
                    +
                    564 // External functions which call several locked_ functions will acquire and release the lock for each function. if this occurs in
                    +
                    565 // performance-sensitive code we may want to refactor by adding non-locked functions and creating a new locked_ member function to call them all.
                    + +
                    567 {
                    +
                    568 public: // Functions:
                    +
                    569  ihipDevice_t() {}; // note: calls constructor for _criticalData
                    +
                    570  void init(unsigned device_index, unsigned deviceCnt, hc::accelerator &acc, unsigned flags);
                    +
                    571  ~ihipDevice_t();
                    +
                    572 
                    +
                    573  void locked_addStream(ihipStream_t *s);
                    +
                    574  void locked_removeStream(ihipStream_t *s);
                    +
                    575  void locked_reset();
                    +
                    576  void locked_waitAllStreams();
                    +
                    577  void locked_syncDefaultStream(bool waitOnSelf);
                    +
                    578 
                    +
                    579  ihipDeviceCritical_t &criticalData() { return _criticalData; }; // TODO, move private. Fix P2P.
                    580 
                    -
                    581  hipDeviceProp_t _props; // saved device properties.
                    -
                    582  hc::accelerator _acc;
                    -
                    583  hsa_agent_t _hsa_agent; // hsa agent handle
                    -
                    584 
                    -
                    585  // The NULL stream is used if no other stream is specified.
                    -
                    586  // NULL has special synchronization properties with other streams.
                    -
                    587  ihipStream_t *_default_stream;
                    -
                    588 
                    -
                    589 
                    -
                    590  unsigned _compute_units;
                    +
                    581 public: // Data, set at initialization:
                    +
                    582  unsigned _device_index; // index into g_devices.
                    +
                    583 
                    +
                    584  hipDeviceProp_t _props; // saved device properties.
                    +
                    585  hc::accelerator _acc;
                    +
                    586  hsa_agent_t _hsa_agent; // hsa agent handle
                    +
                    587 
                    +
                    588  // The NULL stream is used if no other stream is specified.
                    +
                    589  // NULL has special synchronization properties with other streams.
                    +
                    590  ihipStream_t *_default_stream;
                    591 
                    -
                    592  StagingBuffer *_staging_buffer[2]; // one buffer for each direction.
                    -
                    593 
                    +
                    592 
                    +
                    593  unsigned _compute_units;
                    594 
                    -
                    595  unsigned _device_flags;
                    +
                    595  StagingBuffer *_staging_buffer[2]; // one buffer for each direction.
                    596 
                    -
                    597 private:
                    -
                    598  hipError_t getProperties(hipDeviceProp_t* prop);
                    +
                    597 
                    +
                    598  unsigned _device_flags;
                    599 
                    -
                    600 private: // Critical data, protected with locked access:
                    -
                    601  // Members of _protected data MUST be accessed through the LockedAccessor.
                    -
                    602  // Search for LockedAccessor<ihipDeviceCritical_t> for examples; do not access _criticalData directly.
                    -
                    603  ihipDeviceCritical_t _criticalData;
                    -
                    604 
                    -
                    605 };
                    -
                    606 
                    +
                    600 private:
                    +
                    601  hipError_t getProperties(hipDeviceProp_t* prop);
                    +
                    602 
                    +
                    603 private: // Critical data, protected with locked access:
                    +
                    604  // Members of _protected data MUST be accessed through the LockedAccessor.
                    +
                    605  // Search for LockedAccessor<ihipDeviceCritical_t> for examples; do not access _criticalData directly.
                    +
                    606  ihipDeviceCritical_t _criticalData;
                    607 
                    -
                    608 
                    -
                    609 // Global variable definition:
                    -
                    610 extern std::once_flag hip_initialized;
                    -
                    611 extern ihipDevice_t *g_devices; // Array of all non-emulated (ie GPU) accelerators in the system.
                    -
                    612 extern bool g_visible_device; // Set the flag when HIP_VISIBLE_DEVICES is set
                    -
                    613 extern unsigned g_deviceCnt;
                    -
                    614 extern std::vector<int> g_hip_visible_devices; /* vector of integers that contains the visible device IDs */
                    -
                    615 extern hsa_agent_t g_cpu_agent ; // the CPU agent.
                    -
                    616 //=================================================================================================
                    -
                    617 void ihipInit();
                    -
                    618 const char *ihipErrorString(hipError_t);
                    -
                    619 ihipDevice_t *ihipGetTlsDefaultDevice();
                    -
                    620 ihipDevice_t *ihipGetDevice(int);
                    -
                    621 void ihipSetTs(hipEvent_t e);
                    -
                    622 
                    -
                    623 template<typename T>
                    -
                    624 hc::completion_future ihipMemcpyKernel(hipStream_t, T*, const T*, size_t);
                    +
                    608 };
                    +
                    609 
                    +
                    610 
                    +
                    611 
                    +
                    612 // Global variable definition:
                    +
                    613 extern std::once_flag hip_initialized;
                    +
                    614 extern ihipDevice_t *g_devices; // Array of all non-emulated (ie GPU) accelerators in the system.
                    +
                    615 extern bool g_visible_device; // Set the flag when HIP_VISIBLE_DEVICES is set
                    +
                    616 extern unsigned g_deviceCnt;
                    +
                    617 extern std::vector<int> g_hip_visible_devices; /* vector of integers that contains the visible device IDs */
                    +
                    618 extern hsa_agent_t g_cpu_agent ; // the CPU agent.
                    +
                    619 //=================================================================================================
                    +
                    620 void ihipInit();
                    +
                    621 const char *ihipErrorString(hipError_t);
                    +
                    622 ihipDevice_t *ihipGetTlsDefaultDevice();
                    +
                    623 ihipDevice_t *ihipGetDevice(int);
                    +
                    624 void ihipSetTs(hipEvent_t e);
                    625 
                    626 template<typename T>
                    -
                    627 hc::completion_future ihipMemsetKernel(hipStream_t, T*, T, size_t);
                    +
                    627 hc::completion_future ihipMemcpyKernel(hipStream_t, T*, const T*, size_t);
                    628 
                    -
                    629 hipStream_t ihipSyncAndResolveStream(hipStream_t);
                    -
                    630 template <typename T>
                    +
                    629 template<typename T>
                    +
                    630 hc::completion_future ihipMemsetKernel(hipStream_t, T*, T, size_t);
                    631 
                    -
                    632 hc::completion_future
                    -
                    633 ihipMemsetKernel(hipStream_t stream, T * ptr, T val, size_t sizeBytes)
                    -
                    634 {
                    -
                    635  int wg = std::min((unsigned)8, stream->getDevice()->_compute_units);
                    -
                    636  const int threads_per_wg = 256;
                    -
                    637 
                    -
                    638  int threads = wg * threads_per_wg;
                    -
                    639  if (threads > sizeBytes) {
                    -
                    640  threads = ((sizeBytes + threads_per_wg - 1) / threads_per_wg) * threads_per_wg;
                    -
                    641  }
                    -
                    642 
                    -
                    643 
                    -
                    644  hc::extent<1> ext(threads);
                    -
                    645  auto ext_tile = ext.tile(threads_per_wg);
                    +
                    632 hipStream_t ihipSyncAndResolveStream(hipStream_t);
                    +
                    633 template <typename T>
                    +
                    634 
                    +
                    635 hc::completion_future
                    +
                    636 ihipMemsetKernel(hipStream_t stream, T * ptr, T val, size_t sizeBytes)
                    +
                    637 {
                    +
                    638  int wg = std::min((unsigned)8, stream->getDevice()->_compute_units);
                    +
                    639  const int threads_per_wg = 256;
                    +
                    640 
                    +
                    641  int threads = wg * threads_per_wg;
                    +
                    642  if (threads > sizeBytes) {
                    +
                    643  threads = ((sizeBytes + threads_per_wg - 1) / threads_per_wg) * threads_per_wg;
                    +
                    644  }
                    +
                    645 
                    646 
                    -
                    647  hc::completion_future cf =
                    -
                    648  hc::parallel_for_each(
                    -
                    649  stream->_av,
                    -
                    650  ext_tile,
                    -
                    651  [=] (hc::tiled_index<1> idx)
                    -
                    652  __attribute__((hc))
                    -
                    653  {
                    -
                    654  int offset = amp_get_global_id(0);
                    -
                    655  // TODO-HCC - change to hc_get_local_size()
                    -
                    656  int stride = amp_get_local_size(0) * hc_get_num_groups(0) ;
                    -
                    657 
                    -
                    658  for (int i=offset; i<sizeBytes; i+=stride) {
                    -
                    659  ptr[i] = val;
                    -
                    660  }
                    -
                    661  });
                    -
                    662 
                    -
                    663  return cf;
                    -
                    664 }
                    +
                    647  hc::extent<1> ext(threads);
                    +
                    648  auto ext_tile = ext.tile(threads_per_wg);
                    +
                    649 
                    +
                    650  hc::completion_future cf =
                    +
                    651  hc::parallel_for_each(
                    +
                    652  stream->_av,
                    +
                    653  ext_tile,
                    +
                    654  [=] (hc::tiled_index<1> idx)
                    +
                    655  __attribute__((hc))
                    +
                    656  {
                    +
                    657  int offset = amp_get_global_id(0);
                    +
                    658  // TODO-HCC - change to hc_get_local_size()
                    +
                    659  int stride = amp_get_local_size(0) * hc_get_num_groups(0) ;
                    +
                    660 
                    +
                    661  for (int i=offset; i<sizeBytes; i+=stride) {
                    +
                    662  ptr[i] = val;
                    +
                    663  }
                    +
                    664  });
                    665 
                    -
                    666 template <typename T>
                    -
                    667 hc::completion_future
                    -
                    668 ihipMemcpyKernel(hipStream_t stream, T * c, const T * a, size_t sizeBytes)
                    -
                    669 {
                    -
                    670  int wg = std::min((unsigned)8, stream->getDevice()->_compute_units);
                    -
                    671  const int threads_per_wg = 256;
                    -
                    672 
                    -
                    673  int threads = wg * threads_per_wg;
                    -
                    674  if (threads > sizeBytes) {
                    -
                    675  threads = ((sizeBytes + threads_per_wg - 1) / threads_per_wg) * threads_per_wg;
                    -
                    676  }
                    -
                    677 
                    -
                    678 
                    -
                    679  hc::extent<1> ext(threads);
                    -
                    680  auto ext_tile = ext.tile(threads_per_wg);
                    +
                    666  return cf;
                    +
                    667 }
                    +
                    668 
                    +
                    669 template <typename T>
                    +
                    670 hc::completion_future
                    +
                    671 ihipMemcpyKernel(hipStream_t stream, T * c, const T * a, size_t sizeBytes)
                    +
                    672 {
                    +
                    673  int wg = std::min((unsigned)8, stream->getDevice()->_compute_units);
                    +
                    674  const int threads_per_wg = 256;
                    +
                    675 
                    +
                    676  int threads = wg * threads_per_wg;
                    +
                    677  if (threads > sizeBytes) {
                    +
                    678  threads = ((sizeBytes + threads_per_wg - 1) / threads_per_wg) * threads_per_wg;
                    +
                    679  }
                    +
                    680 
                    681 
                    -
                    682  hc::completion_future cf =
                    -
                    683  hc::parallel_for_each(
                    -
                    684  stream->_av,
                    -
                    685  ext_tile,
                    -
                    686  [=] (hc::tiled_index<1> idx)
                    -
                    687  __attribute__((hc))
                    -
                    688  {
                    -
                    689  int offset = amp_get_global_id(0);
                    -
                    690  // TODO-HCC - change to hc_get_local_size()
                    -
                    691  int stride = amp_get_local_size(0) * hc_get_num_groups(0) ;
                    -
                    692 
                    -
                    693  for (int i=offset; i<sizeBytes; i+=stride) {
                    -
                    694  c[i] = a[i];
                    -
                    695  }
                    -
                    696  });
                    -
                    697 
                    -
                    698  return cf;
                    -
                    699 }
                    +
                    682  hc::extent<1> ext(threads);
                    +
                    683  auto ext_tile = ext.tile(threads_per_wg);
                    +
                    684 
                    +
                    685  hc::completion_future cf =
                    +
                    686  hc::parallel_for_each(
                    +
                    687  stream->_av,
                    +
                    688  ext_tile,
                    +
                    689  [=] (hc::tiled_index<1> idx)
                    +
                    690  __attribute__((hc))
                    +
                    691  {
                    +
                    692  int offset = amp_get_global_id(0);
                    +
                    693  // TODO-HCC - change to hc_get_local_size()
                    +
                    694  int stride = amp_get_local_size(0) * hc_get_num_groups(0) ;
                    +
                    695 
                    +
                    696  for (int i=offset; i<sizeBytes; i+=stride) {
                    +
                    697  c[i] = a[i];
                    +
                    698  }
                    +
                    699  });
                    700 
                    -
                    701 #endif
                    -
                    Definition: hip_hcc.h:563
                    +
                    701  return cf;
                    +
                    702 }
                    +
                    703 
                    +
                    704 #endif
                    +
                    Definition: hip_hcc.h:566
                    Definition: hip_hcc.h:340
                    Definition: hip_hcc.h:279
                    hipError_t
                    Definition: hip_runtime_api.h:142
                    @@ -807,7 +810,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hip__runtime_8h_source.html b/docs/RuntimeAPI/html/hip__runtime_8h_source.html index 1fff5853a6..4776bfead4 100644 --- a/docs/RuntimeAPI/html/hip__runtime_8h_source.html +++ b/docs/RuntimeAPI/html/hip__runtime_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hip_runtime.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hip_runtime.h Source File @@ -129,27 +129,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    48 #endif
                    49 
                    50 
                    -
                    51 #include <hip_common.h>
                    +
                    51 #include <hip/hip_common.h>
                    52 
                    53 #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__)
                    -
                    54 #include <hcc_detail/hip_runtime.h>
                    +
                    54 #include <hip/hcc_detail/hip_runtime.h>
                    55 #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__)
                    -
                    56 #include <nvcc_detail/hip_runtime.h>
                    +
                    56 #include <hip/nvcc_detail/hip_runtime.h>
                    57 #else
                    58 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__");
                    59 #endif
                    60 
                    61 
                    -
                    62 #include <hip_runtime_api.h>
                    -
                    63 #include <hip_vector_types.h>
                    +
                    62 #include <hip/hip_runtime_api.h>
                    +
                    63 #include <hip/hip_vector_types.h>
                    64 
                    - -
                    Contains definitions of APIs for HIP runtime.
                    - diff --git a/docs/RuntimeAPI/html/hip__runtime__api_8h_source.html b/docs/RuntimeAPI/html/hip__runtime__api_8h_source.html index 0e70e6336e..604563cbe3 100644 --- a/docs/RuntimeAPI/html/hip__runtime__api_8h_source.html +++ b/docs/RuntimeAPI/html/hip__runtime__api_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hip_runtime_api.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hip_runtime_api.h Source File @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    30 
                    31 
                    32 #include <string.h> // for getDeviceProp
                    -
                    33 #include <hip_common.h>
                    +
                    33 #include <hip/hip_common.h>
                    34 
                    35 typedef struct {
                    36  // 32-bit Atomics
                    @@ -263,9 +263,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    197 
                    202 #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__)
                    - +
                    203 #include "hip/hcc_detail/hip_runtime_api.h"
                    204 #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__)
                    -
                    205 #include "nvcc_detail/hip_runtime_api.h"
                    +
                    205 #include "hip/nvcc_detail/hip_runtime_api.h"
                    206 #else
                    207 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__");
                    208 #endif
                    @@ -359,7 +359,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    int pciDeviceID
                    PCI Device ID.
                    Definition: hip_runtime_api.h:97
                    char name[256]
                    Device name.
                    Definition: hip_runtime_api.h:75
                    Definition: hip_runtime_api.h:35
                    -
                    Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
                    int memoryClockRate
                    Max global memory clock frequency in khz.
                    Definition: hip_runtime_api.h:84
                    TODO comment from hipErrorInitializationError.
                    Definition: hip_runtime_api.h:153
                    Device can possibly execute multiple kernels concurrently.
                    Definition: hip_runtime_api.h:191
                    @@ -367,7 +366,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hip__texture_8h.html b/docs/RuntimeAPI/html/hip__texture_8h.html index 1e7af77260..ed84404545 100644 --- a/docs/RuntimeAPI/html/hip__texture_8h.html +++ b/docs/RuntimeAPI/html/hip__texture_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_texture.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_texture.h File Reference @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

                    HIP C++ Texture API for hcc compiler. More...

                    #include <limits.h>
                    -#include <hip_runtime.h>
                    +#include <hip/hip_runtime.h>

                    Go to the source code of this file.

                    @@ -199,7 +199,7 @@ template<class T , int dim, enum hipTextureReadMode readMode> diff --git a/docs/RuntimeAPI/html/hip__texture_8h_source.html b/docs/RuntimeAPI/html/hip__texture_8h_source.html index 87da06ba10..1ae7203a08 100644 --- a/docs/RuntimeAPI/html/hip__texture_8h_source.html +++ b/docs/RuntimeAPI/html/hip__texture_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_texture.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_texture.h Source File @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    27 
                    33 #include <limits.h>
                    34 
                    -
                    35 #include <hip_runtime.h>
                    +
                    35 #include <hip/hip_runtime.h>
                    36 
                    37 //----
                    38 //Texture - TODO - likely need to move this to a separate file only included with kernel compilation.
                    @@ -258,7 +258,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    Successful completion.
                    Definition: hip_runtime_api.h:143
                    Definition: hip_texture.h:54
                    Definition: hip_texture.h:58
                    -
                    Contains definitions of APIs for HIP runtime.
                    hipError_t
                    Definition: hip_runtime_api.h:142
                    hipTextureReadMode
                    Definition: hip_texture.h:46
                    hipTextureFilterMode
                    Definition: hip_texture.h:52
                    @@ -266,7 +265,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hip__util_8h_source.html b/docs/RuntimeAPI/html/hip__util_8h_source.html index e5e363a20a..e139a984ef 100644 --- a/docs/RuntimeAPI/html/hip__util_8h_source.html +++ b/docs/RuntimeAPI/html/hip__util_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_util.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_util.h Source File @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/hip__vector__types_8h_source.html b/docs/RuntimeAPI/html/hip__vector__types_8h_source.html index f1dc0033b2..bf88422fb1 100644 --- a/docs/RuntimeAPI/html/hip__vector__types_8h_source.html +++ b/docs/RuntimeAPI/html/hip__vector__types_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hip_vector_types.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hip_vector_types.h Source File @@ -113,23 +113,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    23 
                    24 #pragma once
                    25 
                    -
                    26 #include <hip_common.h>
                    +
                    26 #include <hip/hip_common.h>
                    27 
                    28 
                    29 #if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__)
                    30 #if __cplusplus
                    - +
                    31 #include <hip/hcc_detail/hip_vector_types.h>
                    32 #endif
                    33 #elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__)
                    34 #include <vector_types.h>
                    35 #else
                    36 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__");
                    37 #endif
                    -
                    Defines the different newt vector types for HIP runtime.
                    diff --git a/docs/RuntimeAPI/html/host__defines_8h.html b/docs/RuntimeAPI/html/host__defines_8h.html index 872875a617..e6a0f4c745 100644 --- a/docs/RuntimeAPI/html/host__defines_8h.html +++ b/docs/RuntimeAPI/html/host__defines_8h.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/host_defines.h File Reference +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/host_defines.h File Reference @@ -139,7 +139,7 @@ Macros diff --git a/docs/RuntimeAPI/html/host__defines_8h_source.html b/docs/RuntimeAPI/html/host__defines_8h_source.html index e99cb884f2..d52a1e6c0e 100644 --- a/docs/RuntimeAPI/html/host__defines_8h_source.html +++ b/docs/RuntimeAPI/html/host__defines_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/host_defines.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/host_defines.h Source File @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/index.html b/docs/RuntimeAPI/html/index.html index 4cf966b886..620fc7a2dd 100644 --- a/docs/RuntimeAPI/html/index.html +++ b/docs/RuntimeAPI/html/index.html @@ -91,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/modules.html b/docs/RuntimeAPI/html/modules.html index 2cc2f1d979..4b42aad93c 100644 --- a/docs/RuntimeAPI/html/modules.html +++ b/docs/RuntimeAPI/html/modules.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/pages.html b/docs/RuntimeAPI/html/pages.html index 2a0866d812..feeb12c8f1 100644 --- a/docs/RuntimeAPI/html/pages.html +++ b/docs/RuntimeAPI/html/pages.html @@ -88,7 +88,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/staging__buffer_8h_source.html b/docs/RuntimeAPI/html/staging__buffer_8h_source.html index d828c08e98..ab3355af51 100644 --- a/docs/RuntimeAPI/html/staging__buffer_8h_source.html +++ b/docs/RuntimeAPI/html/staging__buffer_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/staging_buffer.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/staging_buffer.h Source File @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structLockedBase-members.html b/docs/RuntimeAPI/html/structLockedBase-members.html index f61745aef7..ae686aeb6e 100644 --- a/docs/RuntimeAPI/html/structLockedBase-members.html +++ b/docs/RuntimeAPI/html/structLockedBase-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
                    diff --git a/docs/RuntimeAPI/html/structLockedBase.html b/docs/RuntimeAPI/html/structLockedBase.html index 989ab46e91..da945347a1 100644 --- a/docs/RuntimeAPI/html/structLockedBase.html +++ b/docs/RuntimeAPI/html/structLockedBase.html @@ -118,12 +118,12 @@ MUTEX_TYPE 
                    _mutex
                     

                    The documentation for this struct was generated from the following file:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    diff --git a/docs/RuntimeAPI/html/structStagingBuffer-members.html b/docs/RuntimeAPI/html/structStagingBuffer-members.html index 4f4e5a39b8..9c47a5d15e 100644 --- a/docs/RuntimeAPI/html/structStagingBuffer-members.html +++ b/docs/RuntimeAPI/html/structStagingBuffer-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structStagingBuffer.html b/docs/RuntimeAPI/html/structStagingBuffer.html index e42819ba22..64a05ded7e 100644 --- a/docs/RuntimeAPI/html/structStagingBuffer.html +++ b/docs/RuntimeAPI/html/structStagingBuffer.html @@ -117,13 +117,13 @@ static const int _max_buff  
                    The documentation for this struct was generated from the following files:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/staging_buffer.h
                    • -
                    • /home/mangupta/hip_git/rel0.84.0/src/staging_buffer.cpp
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/staging_buffer.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/src/staging_buffer.cpp
                    diff --git a/docs/RuntimeAPI/html/structdim3-members.html b/docs/RuntimeAPI/html/structdim3-members.html index d032c0681f..ac9ae244d8 100644 --- a/docs/RuntimeAPI/html/structdim3-members.html +++ b/docs/RuntimeAPI/html/structdim3-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structdim3.html b/docs/RuntimeAPI/html/structdim3.html index 09fd3810a8..c6fbec3499 100644 --- a/docs/RuntimeAPI/html/structdim3.html +++ b/docs/RuntimeAPI/html/structdim3.html @@ -111,12 +111,12 @@ uint32_t 

                    Detailed Description

                    Struct for data in 3D


                    The documentation for this struct was generated from the following file: diff --git a/docs/RuntimeAPI/html/structhipChannelFormatDesc-members.html b/docs/RuntimeAPI/html/structhipChannelFormatDesc-members.html index 39c50e6d86..bbb75cc17b 100644 --- a/docs/RuntimeAPI/html/structhipChannelFormatDesc-members.html +++ b/docs/RuntimeAPI/html/structhipChannelFormatDesc-members.html @@ -94,7 +94,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structhipChannelFormatDesc.html b/docs/RuntimeAPI/html/structhipChannelFormatDesc.html index c41de11d98..fec2b62496 100644 --- a/docs/RuntimeAPI/html/structhipChannelFormatDesc.html +++ b/docs/RuntimeAPI/html/structhipChannelFormatDesc.html @@ -98,12 +98,12 @@ int _dummy  
                    The documentation for this struct was generated from the following file:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_texture.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_texture.h
                    diff --git a/docs/RuntimeAPI/html/structhipDeviceArch__t-members.html b/docs/RuntimeAPI/html/structhipDeviceArch__t-members.html index 0e942bc0f6..49f3d1cfd3 100644 --- a/docs/RuntimeAPI/html/structhipDeviceArch__t-members.html +++ b/docs/RuntimeAPI/html/structhipDeviceArch__t-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structhipDeviceArch__t.html b/docs/RuntimeAPI/html/structhipDeviceArch__t.html index 6f4c668d1a..d8c3e5dc46 100644 --- a/docs/RuntimeAPI/html/structhipDeviceArch__t.html +++ b/docs/RuntimeAPI/html/structhipDeviceArch__t.html @@ -163,12 +163,12 @@ unsigned  
                    The documentation for this struct was generated from the following file:
                    diff --git a/docs/RuntimeAPI/html/structhipDeviceProp__t-members.html b/docs/RuntimeAPI/html/structhipDeviceProp__t-members.html index 192f0b81d3..8defe33756 100644 --- a/docs/RuntimeAPI/html/structhipDeviceProp__t-members.html +++ b/docs/RuntimeAPI/html/structhipDeviceProp__t-members.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structhipDeviceProp__t.html b/docs/RuntimeAPI/html/structhipDeviceProp__t.html index fdf4a3eb4a..d522b400a9 100644 --- a/docs/RuntimeAPI/html/structhipDeviceProp__t.html +++ b/docs/RuntimeAPI/html/structhipDeviceProp__t.html @@ -203,12 +203,12 @@ int 

                    Detailed Description

                    hipDeviceProp


                    The documentation for this struct was generated from the following file: diff --git a/docs/RuntimeAPI/html/structhipEvent__t-members.html b/docs/RuntimeAPI/html/structhipEvent__t-members.html index 2b65f6f763..b0771e38af 100644 --- a/docs/RuntimeAPI/html/structhipEvent__t-members.html +++ b/docs/RuntimeAPI/html/structhipEvent__t-members.html @@ -94,7 +94,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structhipEvent__t.html b/docs/RuntimeAPI/html/structhipEvent__t.html index cf54bdab84..4b11f341ef 100644 --- a/docs/RuntimeAPI/html/structhipEvent__t.html +++ b/docs/RuntimeAPI/html/structhipEvent__t.html @@ -98,12 +98,12 @@ struct ihipEvent_t *   
                    The documentation for this struct was generated from the following file: diff --git a/docs/RuntimeAPI/html/structhipPointerAttribute__t-members.html b/docs/RuntimeAPI/html/structhipPointerAttribute__t-members.html index eef653815e..d1336c466e 100644 --- a/docs/RuntimeAPI/html/structhipPointerAttribute__t-members.html +++ b/docs/RuntimeAPI/html/structhipPointerAttribute__t-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structhipPointerAttribute__t.html b/docs/RuntimeAPI/html/structhipPointerAttribute__t.html index 87021957d5..5001dcd04b 100644 --- a/docs/RuntimeAPI/html/structhipPointerAttribute__t.html +++ b/docs/RuntimeAPI/html/structhipPointerAttribute__t.html @@ -117,12 +117,12 @@ unsigned allocationFlags

                    Detailed Description

                    Pointer attributes


                    The documentation for this struct was generated from the following file: diff --git a/docs/RuntimeAPI/html/structihipEvent__t-members.html b/docs/RuntimeAPI/html/structihipEvent__t-members.html index 7623e17249..39b6ea3e46 100644 --- a/docs/RuntimeAPI/html/structihipEvent__t-members.html +++ b/docs/RuntimeAPI/html/structihipEvent__t-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structihipEvent__t.html b/docs/RuntimeAPI/html/structihipEvent__t.html index 26b4c2a9cf..ea9db7510a 100644 --- a/docs/RuntimeAPI/html/structihipEvent__t.html +++ b/docs/RuntimeAPI/html/structihipEvent__t.html @@ -113,12 +113,12 @@ SIGSEQNUM _copy_seq_id  
                    The documentation for this struct was generated from the following file:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    diff --git a/docs/RuntimeAPI/html/structihipSignal__t-members.html b/docs/RuntimeAPI/html/structihipSignal__t-members.html index 6461109109..83c49b4ee4 100644 --- a/docs/RuntimeAPI/html/structihipSignal__t-members.html +++ b/docs/RuntimeAPI/html/structihipSignal__t-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structihipSignal__t.html b/docs/RuntimeAPI/html/structihipSignal__t.html index 6d1372a29d..9c17d1f040 100644 --- a/docs/RuntimeAPI/html/structihipSignal__t.html +++ b/docs/RuntimeAPI/html/structihipSignal__t.html @@ -111,13 +111,13 @@ SIGSEQNUM _sig_id  
                    The documentation for this struct was generated from the following files:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_hcc.h
                    • -
                    • /home/mangupta/hip_git/rel0.84.0/src/hip_hcc.cpp
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_hcc.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/src/hip_hcc.cpp
                    diff --git a/docs/RuntimeAPI/html/structtextureReference-members.html b/docs/RuntimeAPI/html/structtextureReference-members.html index 6e42d07c6d..b180867696 100644 --- a/docs/RuntimeAPI/html/structtextureReference-members.html +++ b/docs/RuntimeAPI/html/structtextureReference-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/RuntimeAPI/html/structtextureReference.html b/docs/RuntimeAPI/html/structtextureReference.html index a7592835bd..546733072a 100644 --- a/docs/RuntimeAPI/html/structtextureReference.html +++ b/docs/RuntimeAPI/html/structtextureReference.html @@ -104,12 +104,12 @@ bool normalized 
                    The documentation for this struct was generated from the following file:
                      -
                    • /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/hip_texture.h
                    • +
                    • /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/hip_texture.h
                    diff --git a/docs/RuntimeAPI/html/trace__helper_8h_source.html b/docs/RuntimeAPI/html/trace__helper_8h_source.html index ad334e43a6..825ead43b9 100644 --- a/docs/RuntimeAPI/html/trace__helper_8h_source.html +++ b/docs/RuntimeAPI/html/trace__helper_8h_source.html @@ -4,7 +4,7 @@ -HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/rel0.84.0/include/hcc_detail/trace_helper.h Source File +HIP: Heterogenous-computing Interface for Portability: /home/mangupta/hip_git/release_0.84.00/include/hcc_detail/trace_helper.h Source File @@ -223,7 +223,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); From 7f37fc4ec7a1e8e494218d5300eb382436caf98c Mon Sep 17 00:00:00 2001 From: pensun Date: Wed, 20 Apr 2016 09:48:35 -0500 Subject: [PATCH 63/82] update hipLaunchKernel API trace information --- include/hcc_detail/hip_runtime.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hcc_detail/hip_runtime.h b/include/hcc_detail/hip_runtime.h index aa420e992d..003ededca0 100644 --- a/include/hcc_detail/hip_runtime.h +++ b/include/hcc_detail/hip_runtime.h @@ -424,7 +424,7 @@ __device__ float __shfl_xor(float input, int lane_mask, int width); #endif __host__ __device__ int min(int arg1, int arg2); -__host__ __device__ int max(int arg1, int arg2); +__host__ __device__ int max(int arg1, int arg2); //TODO - add a couple fast math operations here, the set here will grow : __device__ float __cosf(float x); @@ -515,8 +515,8 @@ do {\ lp.cf = &cf; \ hipStream_t trueStream = (ihipPreLaunchKernel(_stream, &lp.av)); \ if (HIP_TRACE_API) {\ - fprintf(stderr, KGRN "< Date: Wed, 20 Apr 2016 09:57:55 -0500 Subject: [PATCH 64/82] update API trace information for hipLaunchKernel --- include/hcc_detail/hip_runtime.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/include/hcc_detail/hip_runtime.h b/include/hcc_detail/hip_runtime.h index 9f88017215..003ededca0 100644 --- a/include/hcc_detail/hip_runtime.h +++ b/include/hcc_detail/hip_runtime.h @@ -401,13 +401,6 @@ __device__ int __all( int input); __device__ int __any( int input); __device__ unsigned long long int __ballot( int input); -// __ldg function -template -__device__ __forceinline__ T __ldg( const T * addr) -{ - return *addr; -} - // warp shuffle functions #ifdef __cplusplus @@ -431,7 +424,7 @@ __device__ float __shfl_xor(float input, int lane_mask, int width); #endif __host__ __device__ int min(int arg1, int arg2); -__host__ __device__ int max(int arg1, int arg2); +__host__ __device__ int max(int arg1, int arg2); //TODO - add a couple fast math operations here, the set here will grow : __device__ float __cosf(float x); @@ -522,8 +515,8 @@ do {\ lp.cf = &cf; \ hipStream_t trueStream = (ihipPreLaunchKernel(_stream, &lp.av)); \ if (HIP_TRACE_API) {\ - fprintf(stderr, KGRN "< Date: Wed, 20 Apr 2016 12:25:40 -0500 Subject: [PATCH 65/82] added support for __ldg --- CMakeLists.txt | 1 + bin/hipcc | 2 +- include/hcc_detail/hip_ldg.h | 39 +++++++++++++++ include/hcc_detail/hip_runtime.h | 1 + src/hip_hcc.cpp | 36 +++++++------- src/hip_ldg.cpp | 42 ++++++++++++++++ tests/src/Makefile | 8 ++-- tests/src/hip_ldg.cpp | 82 ++++++++++++++++++-------------- 8 files changed, 153 insertions(+), 58 deletions(-) create mode 100644 include/hcc_detail/hip_ldg.h create mode 100644 src/hip_ldg.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 25459766ba..9b62c20e59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,7 @@ if(HIP_PLATFORM STREQUAL "hcc") src/hip_device.cpp src/hip_error.cpp src/hip_event.cpp + src/hip_ldg.cpp src/hip_memory.cpp src/hip_peer.cpp src/hip_stream.cpp diff --git a/bin/hipcc b/bin/hipcc index 22e2dbaa55..c62fd504a9 100755 --- a/bin/hipcc +++ b/bin/hipcc @@ -200,7 +200,7 @@ if ($needHipHcc) { if ($HIP_USE_SHARED_LIBRARY) { $HIPLDFLAGS .= " -L$HIP_PATH/lib -Wl,--rpath=$HIP_PATH/lib -lhip_hcc"; } else { - $HIPLDFLAGS .= " $HIP_PATH/lib/device_util.cpp.o $HIP_PATH/lib/hip_device.cpp.o $HIP_PATH/lib/hip_error.cpp.o $HIP_PATH/lib/hip_event.cpp.o $HIP_PATH/lib/hip_hcc.cpp.o $HIP_PATH/lib/hip_memory.cpp.o $HIP_PATH/lib/hip_peer.cpp.o $HIP_PATH/lib/hip_stream.cpp.o $HIP_PATH/lib/staging_buffer.cpp.o"; + $HIPLDFLAGS .= " $HIP_PATH/lib/device_util.cpp.o $HIP_PATH/lib/hip_device.cpp.o $HIP_PATH/lib/hip_error.cpp.o $HIP_PATH/lib/hip_event.cpp.o $HIP_PATH/lib/hip_hcc.cpp.o $HIP_PATH/lib/hip_memory.cpp.o $HIP_PATH/lib/hip_peer.cpp.o $HIP_PATH/lib/hip_stream.cpp.o $HIP_PATH/lib/staging_buffer.cpp.o $HIP_PATH/lib/hip_ldg.cpp.o"; } } diff --git a/include/hcc_detail/hip_ldg.h b/include/hcc_detail/hip_ldg.h new file mode 100644 index 0000000000..93ce12635c --- /dev/null +++ b/include/hcc_detail/hip_ldg.h @@ -0,0 +1,39 @@ +#ifndef HIP_LDG_H +#define HIP_LDG_H + +#if __HCC__ +#include"hip_vector_types.h" +#include"host_defines.h" +__device__ char __ldg(const char* ); +__device__ signed char __ldg(const signed char* ); +__device__ short __ldg(const short* ); +__device__ int __ldg(const int* ); +__device__ long __ldg(const long* ); +__device__ long long __ldg(const long long* ); +__device__ char2 __ldg(const char2* ); +__device__ char4 __ldg(const char4* ); +__device__ short2 __ldg(const short2* ); +__device__ short4 __ldg(const short4* ); +__device__ int2 __ldg(const int2* ); +__device__ int4 __ldg(const int4* ); +__device__ longlong2 __ldg(const longlong2* ); +__device__ unsigned char __ldg(const unsigned char* ); +__device__ unsigned short __ldg(const unsigned short* ); +__device__ unsigned int __ldg(const unsigned int* ); +__device__ unsigned long __ldg(const unsigned long* ); +__device__ unsigned long long __ldg(const unsigned long long* ); +__device__ uchar2 __ldg(const uchar2* ); +__device__ uchar4 __ldg(const uchar4* ); +__device__ ushort2 __ldg(const ushort2* ); +__device__ uint2 __ldg(const uint2* ); +__device__ uint4 __ldg(const uint4* ); +__device__ ulonglong2 __ldg(const ulonglong2* ); +__device__ float __ldg(const float* ); +__device__ double __ldg(const double* ); +__device__ float2 __ldg(const float2* ); +__device__ float4 __ldg(const float4* ); +__device__ double2 __ldg(const double2* ); + +#endif + +#endif diff --git a/include/hcc_detail/hip_runtime.h b/include/hcc_detail/hip_runtime.h index 003ededca0..232319c710 100644 --- a/include/hcc_detail/hip_runtime.h +++ b/include/hcc_detail/hip_runtime.h @@ -56,6 +56,7 @@ extern int HIP_TRACE_API; #define hipLaunchParm grid_launch_parm #ifdef __cplusplus #include +#include #endif #include // TODO-HCC remove old definitions ; ~1602 hcc supports __HCC_ACCELERATOR__ define. diff --git a/src/hip_hcc.cpp b/src/hip_hcc.cpp index 04bc92421e..91a26bf971 100644 --- a/src/hip_hcc.cpp +++ b/src/hip_hcc.cpp @@ -1236,12 +1236,12 @@ void ihipStream_t::copySync(LockedAccessor_StreamCrit_t &crit, void* dst, const bool dstTracked = (hc::am_memtracker_getinfo(&dstPtrInfo, dst) == AM_SUCCESS); bool srcTracked = (hc::am_memtracker_getinfo(&srcPtrInfo, src) == AM_SUCCESS); + bool srcInDeviceMem = srcPtrInfo._isInDeviceMem; + bool dstInDeviceMem = dstPtrInfo._isInDeviceMem; // Resolve default to a specific Kind so we know which algorithm to use: if (kind == hipMemcpyDefault) { - bool srcInDeviceMem = (srcTracked && srcPtrInfo._isInDeviceMem); - bool dstInDeviceMem = (dstTracked && dstPtrInfo._isInDeviceMem); - kind = resolveMemcpyDirection(srcTracked, dstTracked, srcPtrInfo._isInDeviceMem, dstPtrInfo._isInDeviceMem); + kind = resolveMemcpyDirection(srcTracked, dstTracked, srcInDeviceMem, dstInDeviceMem); }; hsa_signal_t depSignal; @@ -1259,26 +1259,26 @@ void ihipStream_t::copySync(LockedAccessor_StreamCrit_t &crit, void* dst, const if (kind == hipMemcpyHostToDevice) { int depSignalCnt = preCopyCommand(crit, NULL, &depSignal, ihipCommandCopyH2D); - if (HIP_STAGING_BUFFERS) { - tprintf(DB_COPY1, "D2H && !dstTracked: staged copy H2D dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); + if (HIP_STAGING_BUFFERS) { + tprintf(DB_COPY1, "D2H && !dstTracked: staged copy H2D dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); - if (HIP_PININPLACE) { - device->_staging_buffer[0]->CopyHostToDevicePinInPlace(dst, src, sizeBytes, depSignalCnt ? &depSignal : NULL); - } else { - device->_staging_buffer[0]->CopyHostToDevice(dst, src, sizeBytes, depSignalCnt ? &depSignal : NULL); - } + if (HIP_PININPLACE) { + device->_staging_buffer[0]->CopyHostToDevicePinInPlace(dst, src, sizeBytes, depSignalCnt ? &depSignal : NULL); + } else { + device->_staging_buffer[0]->CopyHostToDevice(dst, src, sizeBytes, depSignalCnt ? &depSignal : NULL); + } - // The copy waits for inputs and then completes before returning so can reset queue to empty: - this->wait(crit, true); - } else { - // TODO - remove, slow path. - tprintf(DB_COPY1, "H2D && ! srcTracked: am_copy dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); + // The copy waits for inputs and then completes before returning so can reset queue to empty: + this->wait(crit, true); + } else { + // TODO - remove, slow path. + tprintf(DB_COPY1, "H2D && ! srcTracked: am_copy dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); #if USE_AV_COPY - _av.copy(src,dst,sizeBytes); + _av.copy(src,dst,sizeBytes); #else - hc::am_copy(dst, src, sizeBytes); + hc::am_copy(dst, src, sizeBytes); #endif - } + } } else if (kind == hipMemcpyDeviceToHost) { int depSignalCnt = preCopyCommand(crit, NULL, &depSignal, ihipCommandCopyD2H); if (HIP_STAGING_BUFFERS) { diff --git a/src/hip_ldg.cpp b/src/hip_ldg.cpp new file mode 100644 index 0000000000..14c461f746 --- /dev/null +++ b/src/hip_ldg.cpp @@ -0,0 +1,42 @@ +#include"hcc_detail/hip_ldg.h" + +__device__ char __ldg(const char* ptr) +{ + return *ptr; +} + +__device__ signed char __ldg(const signed char* ptr) +{ + return ptr[0]; +} + +__device__ short __ldg(const short* ptr) +{ + return ptr[0]; +} + +__device__ int __ldg(const int* ptr) +{ + return ptr[0]; +} + +__device__ long long __ldg(const long long* ptr) +{ + return ptr[0]; +} + + +__device__ int2 __ldg(const int2* ptr) +{ + return ptr[0]; +} + +__device__ int4 __ldg(const int4* ptr) +{ + return ptr[0]; +} + +__device__ float __ldg(const float* ptr) +{ + return ptr[0]; +} diff --git a/tests/src/Makefile b/tests/src/Makefile index cd3025d387..829d45a08c 100644 --- a/tests/src/Makefile +++ b/tests/src/Makefile @@ -9,13 +9,13 @@ OBJECTS=$(SOURCES:.cpp=.o) EXECUTABLE=hipMemset $(EXECUTABLE): $(HIP_DEPS) $(OBJECTS) - $(HCC) $(HLDFLAGS) $(OBJECTS) -o $@ + $(HCC) $(HLDFLAGS) $(OBJECTS) -o $@ .cpp.o: - $(HCC) $(HCFLAGS) -c $< -o $@ - @$(CC) -MM -MT $@ $(CFLAGS) -c $< > $(@:.o=.d) + $(HCC) $(HCFLAGS) -c $< -o $@ + @$(CC) -MM -MT $@ $(CFLAGS) -c $< > $(@:.o=.d) clean: hip_clean - rm -rf $(EXECUTABLE) $(OBJECTS) + rm -rf $(EXECUTABLE) $(OBJECTS) include $(HIP_PATH)/examples/common/hip.epilogue.make diff --git a/tests/src/hip_ldg.cpp b/tests/src/hip_ldg.cpp index 2f281c5991..612eae32e8 100644 --- a/tests/src/hip_ldg.cpp +++ b/tests/src/hip_ldg.cpp @@ -30,18 +30,19 @@ THE SOFTWARE. #define HIP_ASSERT(x) (assert((x)==hipSuccess)) -#define WIDTH 1024 -#define HEIGHT 1024 +#define WIDTH 8 +#define HEIGHT 8 #define NUM (WIDTH*HEIGHT) -#define THREADS_PER_BLOCK_X 16 -#define THREADS_PER_BLOCK_Y 16 +#define THREADS_PER_BLOCK_X 8 +#define THREADS_PER_BLOCK_Y 8 #define THREADS_PER_BLOCK_Z 1 +template __global__ void vectoradd_float(hipLaunchParm lp, - float* a, const float* bm, const float* cm, int width, int height) + T* a, const T* bm, const T* cm, int width, int height) { int x = hipBlockDim_x * hipBlockIdx_x + hipThreadIdx_x; @@ -72,46 +73,35 @@ __kernel__ void vectoradd_float(float* a, const float* b, const float* c, int wi using namespace std; -int main() { - - float* hostA; - float* hostB; - float* hostC; - - float* deviceA; - float* deviceB; - float* deviceC; - - hipDeviceProp_t devProp; - hipGetDeviceProperties(&devProp, 0); - cout << " System minor " << devProp.minor << endl; - cout << " System major " << devProp.major << endl; - cout << " agent prop name " << devProp.name << endl; - - - - cout << "__ldg " << endl ; +template +bool dataTypesRun(){ + T* hostA; + T* hostB; + T* hostC; + T* deviceA; + T* deviceB; + T* deviceC; int i; int errors; - hostA = (float*)malloc(NUM * sizeof(float)); - hostB = (float*)malloc(NUM * sizeof(float)); - hostC = (float*)malloc(NUM * sizeof(float)); + hostA = (T*)malloc(NUM * sizeof(T)); + hostB = (T*)malloc(NUM * sizeof(T)); + hostC = (T*)malloc(NUM * sizeof(T)); // initialize the input data for (i = 0; i < NUM; i++) { - hostB[i] = (float)i; - hostC[i] = (float)i*100.0f; + hostB[i] = (T)i; + hostC[i] = (T)i; } - HIP_ASSERT(hipMalloc((void**)&deviceA, NUM * sizeof(float))); - HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(float))); - HIP_ASSERT(hipMalloc((void**)&deviceC, NUM * sizeof(float))); + HIP_ASSERT(hipMalloc((void**)&deviceA, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceC, NUM * sizeof(T))); - HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(float), hipMemcpyHostToDevice)); - HIP_ASSERT(hipMemcpy(deviceC, hostC, NUM*sizeof(float), hipMemcpyHostToDevice)); + HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(T), hipMemcpyHostToDevice)); + HIP_ASSERT(hipMemcpy(deviceC, hostC, NUM*sizeof(T), hipMemcpyHostToDevice)); hipLaunchKernel(vectoradd_float, @@ -121,8 +111,9 @@ int main() { deviceA ,deviceB ,deviceC ,WIDTH ,HEIGHT); - HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(float), hipMemcpyDeviceToHost)); + HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(T), hipMemcpyDeviceToHost)); + bool ret = false; // verify the results errors = 0; for (i = 0; i < NUM; i++) { @@ -132,8 +123,10 @@ int main() { } if (errors!=0) { printf("FAILED: %d errors\n",errors); + ret = false; } else { printf ("PASSED!\n"); + ret = true; } HIP_ASSERT(hipFree(deviceA)); @@ -144,6 +137,25 @@ int main() { free(hostB); free(hostC); + return ret; + +} + + +int main() { + + hipDeviceProp_t devProp; + hipGetDeviceProperties(&devProp, 0); + cout << " System minor " << devProp.minor << endl; + cout << " System major " << devProp.major << endl; + cout << " agent prop name " << devProp.name << endl; + + int errors; + errors = dataTypesRun(); + errors = dataTypesRun(); + errors = dataTypesRun(); + errors = dataTypesRun(); + cout << "__ldg " << endl ; //hipResetDefaultAccelerator(); return errors; From de7952cd06aaf810bd20d72e26f8e60b80c52070 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Wed, 20 Apr 2016 12:28:02 -0500 Subject: [PATCH 66/82] added copyright for ldg --- include/hcc_detail/hip_ldg.h | 19 +++++++++++++++++++ src/hip_ldg.cpp | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/hcc_detail/hip_ldg.h b/include/hcc_detail/hip_ldg.h index 93ce12635c..d996a978f2 100644 --- a/include/hcc_detail/hip_ldg.h +++ b/include/hcc_detail/hip_ldg.h @@ -1,3 +1,22 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + #ifndef HIP_LDG_H #define HIP_LDG_H diff --git a/src/hip_ldg.cpp b/src/hip_ldg.cpp index 14c461f746..1e35a5cd49 100644 --- a/src/hip_ldg.cpp +++ b/src/hip_ldg.cpp @@ -1,3 +1,22 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + #include"hcc_detail/hip_ldg.h" __device__ char __ldg(const char* ptr) From f74b7a3636ab5c5a44aa7dd164cc7e2558ac5418 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Wed, 20 Apr 2016 14:21:22 -0500 Subject: [PATCH 67/82] added support pinned dma memcpy between host and device --- src/hip_hcc.cpp | 66 +++++++++++++++++---- tests/src/CMakeLists.txt | 6 +- tests/src/hipTestMemcpyPin.cpp | 33 +++++++++++ tests/src/{hip_ldg.cpp => hip_test_ldg.cpp} | 18 +++--- 4 files changed, 99 insertions(+), 24 deletions(-) create mode 100644 tests/src/hipTestMemcpyPin.cpp rename tests/src/{hip_ldg.cpp => hip_test_ldg.cpp} (94%) diff --git a/src/hip_hcc.cpp b/src/hip_hcc.cpp index 91a26bf971..44cccf14fa 100644 --- a/src/hip_hcc.cpp +++ b/src/hip_hcc.cpp @@ -1259,6 +1259,7 @@ void ihipStream_t::copySync(LockedAccessor_StreamCrit_t &crit, void* dst, const if (kind == hipMemcpyHostToDevice) { int depSignalCnt = preCopyCommand(crit, NULL, &depSignal, ihipCommandCopyH2D); + if(!srcTracked){ if (HIP_STAGING_BUFFERS) { tprintf(DB_COPY1, "D2H && !dstTracked: staged copy H2D dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); @@ -1279,24 +1280,65 @@ void ihipStream_t::copySync(LockedAccessor_StreamCrit_t &crit, void* dst, const hc::am_copy(dst, src, sizeBytes); #endif } + }else{ + hsa_agent_t dstAgent = *(static_cast(dstPtrInfo._acc.get_hsa_agent())); + hsa_agent_t srcAgent = *(static_cast(srcPtrInfo._acc.get_hsa_agent())); + + ihipSignal_t *ihipSignal = allocSignal(crit); + hsa_signal_t copyCompleteSignal = ihipSignal->_hsa_signal; + + hsa_signal_store_relaxed(copyCompleteSignal, 1); + void *devPtrSrc = srcPtrInfo._devicePointer; + tprintf(DB_COPY1, "HSA Async_copy dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); + + hsa_status_t hsa_status = hsa_amd_memory_async_copy(dst, dstAgent, devPtrSrc, srcAgent, sizeBytes, depSignalCnt, depSignalCnt ? &depSignal:0x0, copyCompleteSignal); + + // This is sync copy, so let's wait for copy right here: + if (hsa_status == HSA_STATUS_SUCCESS) { + waitCopy(crit, ihipSignal); // wait for copy, and return to pool. + } else { + throw ihipException(hipErrorInvalidValue); + } + } } else if (kind == hipMemcpyDeviceToHost) { int depSignalCnt = preCopyCommand(crit, NULL, &depSignal, ihipCommandCopyD2H); - if (HIP_STAGING_BUFFERS) { - tprintf(DB_COPY1, "D2H && !dstTracked: staged copy D2H dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); - //printf ("staged-copy- read dep signals\n"); - device->_staging_buffer[1]->CopyDeviceToHost(dst, src, sizeBytes, depSignalCnt ? &depSignal : NULL); + if (!dstTracked){ + if (HIP_STAGING_BUFFERS) { + tprintf(DB_COPY1, "D2H && !dstTracked: staged copy D2H dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); + //printf ("staged-copy- read dep signals\n"); + device->_staging_buffer[1]->CopyDeviceToHost(dst, src, sizeBytes, depSignalCnt ? &depSignal : NULL); + + // The copy completes before returning so can reset queue to empty: + this->wait(crit, true); - // The copy completes before returning so can reset queue to empty: - this->wait(crit, true); - - } else { + } else { // TODO - remove, slow path. - tprintf(DB_COPY1, "D2H && !dstTracked: am_copy dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); + tprintf(DB_COPY1, "D2H && !dstTracked: am_copy dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); #if USE_AV_COPY - _av.copy(src, dst, sizeBytes); + _av.copy(src, dst, sizeBytes); #else - hc::am_copy(dst, src, sizeBytes); + hc::am_copy(dst, src, sizeBytes); #endif + } + }else{ + hsa_agent_t dstAgent = *(static_cast(dstPtrInfo._acc.get_hsa_agent())); + hsa_agent_t srcAgent = *(static_cast(srcPtrInfo._acc.get_hsa_agent())); + + ihipSignal_t *ihipSignal = allocSignal(crit); + hsa_signal_t copyCompleteSignal = ihipSignal->_hsa_signal; + + hsa_signal_store_relaxed(copyCompleteSignal, 1); + void *devPtrDst = dstPtrInfo._devicePointer; + tprintf(DB_COPY1, "HSA Async_copy dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); + + hsa_status_t hsa_status = hsa_amd_memory_async_copy(devPtrDst, dstAgent, src, srcAgent, sizeBytes, depSignalCnt, depSignalCnt ? &depSignal:0x0, copyCompleteSignal); + + // This is sync copy, so let's wait for copy right here: + if (hsa_status == HSA_STATUS_SUCCESS) { + waitCopy(crit, ihipSignal); // wait for copy, and return to pool. + } else { + throw ihipException(hipErrorInvalidValue); + } } } else if (kind == hipMemcpyHostToHost) { int depSignalCnt = preCopyCommand(crit, NULL, &depSignal, ihipCommandCopyH2H); @@ -1305,9 +1347,7 @@ void ihipStream_t::copySync(LockedAccessor_StreamCrit_t &crit, void* dst, const // host waits before doing host memory copy. hsa_signal_wait_acquire(depSignal, HSA_SIGNAL_CONDITION_LT, 1, UINT64_MAX, HSA_WAIT_STATE_ACTIVE); } - tprintf(DB_COPY1, "H2H memcpy dst=%p src=%p sz=%zu\n", dst, src, sizeBytes); memcpy(dst, src, sizeBytes); - } else if ((kind == hipMemcpyDeviceToDevice) && !copyEngineCanSeeSrcAndDest) { int depSignalCnt = preCopyCommand(crit, NULL, &depSignal, ihipCommandCopyP2P); if (HIP_STAGING_BUFFERS) { diff --git a/tests/src/CMakeLists.txt b/tests/src/CMakeLists.txt index e58298248b..563cd2c738 100644 --- a/tests/src/CMakeLists.txt +++ b/tests/src/CMakeLists.txt @@ -145,7 +145,7 @@ make_hip_executable (hip_popc hip_popc.cpp) make_hip_executable (hip_clz hip_clz.cpp) make_hip_executable (hip_brev hip_brev.cpp) make_hip_executable (hip_ffs hip_ffs.cpp) -make_hip_executable (hip_ldg hip_ldg.cpp) +make_hip_executable (hip_test_ldg hip_test_ldg.cpp) make_hip_executable (hipGetDeviceAttribute hipGetDeviceAttribute.cpp) make_hip_executable (hipEnvVar hipEnvVar.cpp) make_hip_executable (hipEnvVarDriver hipEnvVarDriver.cpp) @@ -178,6 +178,7 @@ make_hip_executable (hipFuncDeviceSynchronize hipFuncDeviceSynchronize.cpp) make_hip_executable (hipPeerToPeer_simple hipPeerToPeer_simple.cpp) make_hip_executable (hipMemcpyAll hipMemcpyAll.cpp) make_hip_executable (hipMultiThreadDevice hipMultiThreadDevice.cpp) +make_hip_executable (hipTestMemcpyPin hipTestMemcpyPin.cpp) make_test(hip_ballot " " ) make_test(hip_anyall " " ) @@ -185,7 +186,7 @@ make_test(hip_popc " " ) make_test(hip_brev " " ) make_test(hip_clz " " ) make_test(hip_ffs " " ) -make_test(hip_ldg " " ) +make_test(hip_test_ldg " " ) make_test(hipEventRecord --iterations 10) make_test(hipMemset " " ) make_test(hipMemset --N 10 --memsetval 0x42 ) # small copy, just 10 bytes. @@ -222,6 +223,7 @@ make_test(hipFuncSetDeviceFlags " ") make_test(hipFuncGetDevice " ") make_test(hipFuncSetDevice " ") make_test(hipFuncDeviceSynchronize " ") +make_test(hipTestMemcpyPin " ") make_named_test (hipMultiThreadDevice "hipMultiThreadDevice-serial" --tests 0x1) make_named_test (hipMultiThreadDevice "hipMultiThreadDevice-pyramid" --tests 0x4) make_named_test (hipMultiThreadDevice "hipMultiThreadDevice-nearzero" --tests 0x10) diff --git a/tests/src/hipTestMemcpyPin.cpp b/tests/src/hipTestMemcpyPin.cpp new file mode 100644 index 0000000000..c36170003c --- /dev/null +++ b/tests/src/hipTestMemcpyPin.cpp @@ -0,0 +1,33 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include +#include"test_common.h" + +#define len 1024*1024 +#define size len * sizeof(float) + +int main(){ + float *Ad, *A; + hipHostMalloc((void**)&A, size); + hipMalloc((void**)&Ad, size); + assert(hipSuccess == hipMemcpy(Ad, A, size, hipMemcpyHostToDevice)); + assert(hipSuccess == hipMemcpy(A, Ad, size, hipMemcpyDeviceToHost)); + passed(); +} diff --git a/tests/src/hip_ldg.cpp b/tests/src/hip_test_ldg.cpp similarity index 94% rename from tests/src/hip_ldg.cpp rename to tests/src/hip_test_ldg.cpp index 612eae32e8..a58652d240 100644 --- a/tests/src/hip_ldg.cpp +++ b/tests/src/hip_test_ldg.cpp @@ -25,7 +25,7 @@ THE SOFTWARE. #include #include #include "hip_runtime.h" - +#include "test_common.h" #define HIP_ASSERT(x) (assert((x)==hipSuccess)) @@ -125,7 +125,6 @@ bool dataTypesRun(){ printf("FAILED: %d errors\n",errors); ret = false; } else { - printf ("PASSED!\n"); ret = true; } @@ -150,13 +149,14 @@ int main() { cout << " System major " << devProp.major << endl; cout << " agent prop name " << devProp.name << endl; - int errors; - errors = dataTypesRun(); - errors = dataTypesRun(); - errors = dataTypesRun(); - errors = dataTypesRun(); - cout << "__ldg " << endl ; + int errors = dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); //hipResetDefaultAccelerator(); + if(errors == 1){ + passed(); + return 0; + } - return errors; } From df98fd8531e7b099b88bb0f0f9bdbad33abd64e9 Mon Sep 17 00:00:00 2001 From: bwicakso Date: Wed, 20 Apr 2016 15:51:39 -0500 Subject: [PATCH 68/82] Fix for kernel synchronization The completion future of a particular kernel is lost if there are multiple kernels in the stream. This can cause a racing condition where the signal associated with the unreferenced completion_future might get released by hcc runtime. --- include/hcc_detail/hip_hcc.h | 6 +++++- src/hip_hcc.cpp | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/hcc_detail/hip_hcc.h b/include/hcc_detail/hip_hcc.h index 58b58e2c99..5fa9be0fbc 100644 --- a/include/hcc_detail/hip_hcc.h +++ b/include/hcc_detail/hip_hcc.h @@ -440,9 +440,13 @@ public: hc::accelerator_view _av; unsigned _flags; -private: // Critical Data. THis MUST be accessed through LockedAccessor_StreamCrit_t +private: + // Critical Data. THis MUST be accessed through LockedAccessor_StreamCrit_t ihipStreamCritical_t _criticalData; + // Array of dependency completion_future. + std::vector _depFutures; + private: void enqueueBarrier(hsa_queue_t* queue, ihipSignal_t *depSignal); void waitCopy(LockedAccessor_StreamCrit_t &crit, ihipSignal_t *signal); diff --git a/src/hip_hcc.cpp b/src/hip_hcc.cpp index 44cccf14fa..64d529f875 100644 --- a/src/hip_hcc.cpp +++ b/src/hip_hcc.cpp @@ -181,6 +181,8 @@ void ihipStream_t::wait(LockedAccessor_StreamCrit_t &crit, bool assertQueueEmpty // Reset the stream to "empty" - next command will not set up an inpute dependency on any older signal. crit->_last_command_type = ihipCommandCopyH2D; crit->_last_copy_signal = NULL; + + _depFutures.clear(); } @@ -428,6 +430,9 @@ int ihipStream_t::preCopyCommand(LockedAccessor_StreamCrit_t &crit, ihipSignal_t needSync = 1; hsa_signal_t *hsaSignal = (static_cast (crit->_last_kernel_future.get_native_handle())); if (hsaSignal) { + // Keep reference to the kernel future in order to keep the + // dependent signal alive. + _depFutures.push_back(crit->_last_kernel_future); *waitSignal = * hsaSignal; } else { assert(0); // if NULL signal, and we return 1, hsa_amd_memory_copy_async will fail. Confirm this never happens. From ba59ea87ab60757c36a96a84e71397748ad64f27 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Thu, 21 Apr 2016 11:17:26 -0500 Subject: [PATCH 69/82] added full data type support for __ldg --- include/hcc_detail/hip_ldg.h | 98 ++++++++---- src/hip_ldg.cpp | 281 +++++++++++++++++++++++++++++++++-- tests/src/hip_test_ldg.cpp | 149 ++++++++++++++++++- 3 files changed, 481 insertions(+), 47 deletions(-) diff --git a/include/hcc_detail/hip_ldg.h b/include/hcc_detail/hip_ldg.h index d996a978f2..50d5bcbf7a 100644 --- a/include/hcc_detail/hip_ldg.h +++ b/include/hcc_detail/hip_ldg.h @@ -23,35 +23,75 @@ THE SOFTWARE. #if __HCC__ #include"hip_vector_types.h" #include"host_defines.h" -__device__ char __ldg(const char* ); -__device__ signed char __ldg(const signed char* ); -__device__ short __ldg(const short* ); -__device__ int __ldg(const int* ); -__device__ long __ldg(const long* ); -__device__ long long __ldg(const long long* ); -__device__ char2 __ldg(const char2* ); -__device__ char4 __ldg(const char4* ); -__device__ short2 __ldg(const short2* ); -__device__ short4 __ldg(const short4* ); -__device__ int2 __ldg(const int2* ); -__device__ int4 __ldg(const int4* ); -__device__ longlong2 __ldg(const longlong2* ); -__device__ unsigned char __ldg(const unsigned char* ); -__device__ unsigned short __ldg(const unsigned short* ); -__device__ unsigned int __ldg(const unsigned int* ); -__device__ unsigned long __ldg(const unsigned long* ); -__device__ unsigned long long __ldg(const unsigned long long* ); -__device__ uchar2 __ldg(const uchar2* ); -__device__ uchar4 __ldg(const uchar4* ); -__device__ ushort2 __ldg(const ushort2* ); -__device__ uint2 __ldg(const uint2* ); -__device__ uint4 __ldg(const uint4* ); -__device__ ulonglong2 __ldg(const ulonglong2* ); -__device__ float __ldg(const float* ); -__device__ double __ldg(const double* ); -__device__ float2 __ldg(const float2* ); -__device__ float4 __ldg(const float4* ); -__device__ double2 __ldg(const double2* ); + +__device__ char __ldg(const char* ); +__device__ char1 __ldg(const char1* ); +__device__ char2 __ldg(const char2* ); +__device__ char3 __ldg(const char3* ); +__device__ char4 __ldg(const char4* ); +__device__ signed char __ldg(const signed char* ); +__device__ unsigned char __ldg(const unsigned char* ); + +__device__ short __ldg(const short* ); +__device__ short1 __ldg(const short1* ); +__device__ short2 __ldg(const short2* ); +__device__ short3 __ldg(const short3* ); +__device__ short4 __ldg(const short4* ); +__device__ unsigned short __ldg(const unsigned short* ); + +__device__ int __ldg(const int* ); +__device__ int1 __ldg(const int1* ); +__device__ int2 __ldg(const int2* ); +__device__ int3 __ldg(const int3* ); +__device__ int4 __ldg(const int4* ); +__device__ unsigned int __ldg(const unsigned int* ); + + +__device__ long __ldg(const long* ); +__device__ long1 __ldg(const long1* ); +__device__ long2 __ldg(const long2* ); +__device__ long3 __ldg(const long3* ); +__device__ long4 __ldg(const long4* ); +__device__ unsigned long __ldg(const unsigned long* ); + +__device__ long long __ldg(const long long* ); +__device__ longlong1 __ldg(const longlong1* ); +__device__ longlong2 __ldg(const longlong2* ); +__device__ longlong3 __ldg(const longlong3* ); +__device__ longlong4 __ldg(const longlong4* ); +__device__ unsigned long long __ldg(const unsigned long long* ); + +__device__ uchar1 __ldg(const uchar1* ); +__device__ uchar2 __ldg(const uchar2* ); +__device__ uchar3 __ldg(const uchar3* ); +__device__ uchar4 __ldg(const uchar4* ); + +__device__ ushort1 __ldg(const ushort1* ); +__device__ ushort2 __ldg(const ushort2* ); +__device__ ushort3 __ldg(const ushort3* ); +__device__ ushort4 __ldg(const ushort4* ); + +__device__ uint1 __ldg(const uint1* ); +__device__ uint2 __ldg(const uint2* ); +__device__ uint3 __ldg(const uint3* ); +__device__ uint4 __ldg(const uint4* ); + +__device__ ulonglong1 __ldg(const ulonglong1* ); +__device__ ulonglong2 __ldg(const ulonglong2* ); +__device__ ulonglong3 __ldg(const ulonglong3* ); +__device__ ulonglong4 __ldg(const ulonglong4* ); + +__device__ float __ldg(const float* ); +__device__ float1 __ldg(const float1* ); +__device__ float2 __ldg(const float2* ); +__device__ float3 __ldg(const float3* ); +__device__ float4 __ldg(const float4* ); + +__device__ double __ldg(const double* ); +__device__ double1 __ldg(const double1* ); +__device__ double2 __ldg(const double2* ); +__device__ double3 __ldg(const double3* ); +__device__ double4 __ldg(const double4* ); #endif diff --git a/src/hip_ldg.cpp b/src/hip_ldg.cpp index 1e35a5cd49..f59c3e962d 100644 --- a/src/hip_ldg.cpp +++ b/src/hip_ldg.cpp @@ -19,43 +19,300 @@ THE SOFTWARE. #include"hcc_detail/hip_ldg.h" -__device__ char __ldg(const char* ptr) -{ - return *ptr; -} - -__device__ signed char __ldg(const signed char* ptr) +__device__ char __ldg(const char* ptr) { return ptr[0]; } -__device__ short __ldg(const short* ptr) +__device__ char1 __ldg(const char1* ptr) { return ptr[0]; } -__device__ int __ldg(const int* ptr) +__device__ char2 __ldg(const char2* ptr) { return ptr[0]; } -__device__ long long __ldg(const long long* ptr) +__device__ char3 __ldg(const char3* ptr) +{ + return ptr[0]; +} + +__device__ char4 __ldg(const char4* ptr) +{ + return ptr[0]; +} + +__device__ signed char __ldg(const signed char* ptr) +{ + return ptr[0]; +} + +__device__ unsigned char __ldg(const unsigned char* ptr) { return ptr[0]; } -__device__ int2 __ldg(const int2* ptr) +__device__ short __ldg(const short* ptr) { return ptr[0]; } -__device__ int4 __ldg(const int4* ptr) +__device__ short1 __ldg(const short1* ptr) { return ptr[0]; } -__device__ float __ldg(const float* ptr) +__device__ short2 __ldg(const short2* ptr) { return ptr[0]; } + +__device__ short3 __ldg(const short3* ptr) +{ + return ptr[0]; +} + +__device__ short4 __ldg(const short4* ptr) +{ + return ptr[0]; +} + +__device__ unsigned short __ldg(const unsigned short* ptr) +{ + return ptr[0]; +} + + +__device__ int __ldg(const int* ptr) +{ + return ptr[0]; +} + +__device__ int1 __ldg(const int1* ptr) +{ + return ptr[0]; +} + +__device__ int2 __ldg(const int2* ptr) +{ + return ptr[0]; +} + +__device__ int3 __ldg(const int3* ptr) +{ + return ptr[0]; +} + +__device__ int4 __ldg(const int4* ptr) +{ + return ptr[0]; +} + +__device__ unsigned int __ldg(const unsigned int* ptr) +{ + return ptr[0]; +} + + +__device__ long __ldg(const long* ptr) +{ + return ptr[0]; +} + +__device__ long1 __ldg(const long1* ptr) +{ + return ptr[0]; +} + +__device__ long2 __ldg(const long2* ptr) +{ + return ptr[0]; +} + +__device__ long3 __ldg(const long3* ptr) +{ + return ptr[0]; +} + +__device__ long4 __ldg(const long4* ptr) +{ + return ptr[0]; +} + +__device__ unsigned long __ldg(const unsigned long* ptr) +{ + return ptr[0]; +} + + +__device__ long long __ldg(const long long* ptr) +{ + return ptr[0]; +} + +__device__ longlong1 __ldg(const longlong1* ptr) +{ + return ptr[0]; +} + +__device__ longlong2 __ldg(const longlong2* ptr) +{ + return ptr[0]; +} + +__device__ longlong3 __ldg(const longlong3* ptr) +{ + return ptr[0]; +} + +__device__ longlong4 __ldg(const longlong4* ptr) +{ + return ptr[0]; +} + +__device__ unsigned long long __ldg(const unsigned long long* ptr) +{ + return ptr[0]; +} + + +__device__ uchar1 __ldg(const uchar1* ptr) +{ + return ptr[0]; +} + +__device__ uchar2 __ldg(const uchar2* ptr) +{ + return ptr[0]; +} + +__device__ uchar3 __ldg(const uchar3* ptr) +{ + return ptr[0]; +} + +__device__ uchar4 __ldg(const uchar4* ptr) +{ + return ptr[0]; +} + + +__device__ ushort1 __ldg(const ushort1* ptr) +{ + return ptr[0]; +} + +__device__ ushort2 __ldg(const ushort2* ptr) +{ + return ptr[0]; +} + +__device__ ushort3 __ldg(const ushort3* ptr) +{ + return ptr[0]; +} + +__device__ ushort4 __ldg(const ushort4* ptr) +{ + return ptr[0]; +} + + +__device__ uint1 __ldg(const uint1* ptr) +{ + return ptr[0]; +} + +__device__ uint2 __ldg(const uint2* ptr) +{ + return ptr[0]; +} + +__device__ uint3 __ldg(const uint3* ptr) +{ + return ptr[0]; +} + +__device__ uint4 __ldg(const uint4* ptr) +{ + return ptr[0]; +} + + +__device__ ulonglong1 __ldg(const ulonglong1* ptr) +{ + return ptr[0]; +} + +__device__ ulonglong2 __ldg(const ulonglong2* ptr) +{ + return ptr[0]; +} + +__device__ ulonglong3 __ldg(const ulonglong3* ptr) +{ + return ptr[0]; +} + +__device__ ulonglong4 __ldg(const ulonglong4* ptr) +{ + return ptr[0]; +} + + +__device__ float __ldg(const float* ptr) +{ + return ptr[0]; +} + +__device__ float1 __ldg(const float1* ptr) +{ + return ptr[0]; +} + +__device__ float2 __ldg(const float2* ptr) +{ + return ptr[0]; +} + +__device__ float3 __ldg(const float3* ptr) +{ + return ptr[0]; +} + +__device__ float4 __ldg(const float4* ptr) +{ + return ptr[0]; +} + + +__device__ double __ldg(const double* ptr) +{ + return ptr[0]; +} + +__device__ double1 __ldg(const double1* ptr) +{ + return ptr[0]; +} + +__device__ double2 __ldg(const double2* ptr) +{ + return ptr[0]; +} + +__device__ double3 __ldg(const double3* ptr) +{ + return ptr[0]; +} + +__device__ double4 __ldg(const double4* ptr) +{ + return ptr[0]; +} + + + diff --git a/tests/src/hip_test_ldg.cpp b/tests/src/hip_test_ldg.cpp index a58652d240..9d605fea5c 100644 --- a/tests/src/hip_test_ldg.cpp +++ b/tests/src/hip_test_ldg.cpp @@ -149,14 +149,151 @@ int main() { cout << " System major " << devProp.major << endl; cout << " agent prop name " << devProp.name << endl; - int errors = dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); + int errors; + + errors = dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Char"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Short"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Int"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Long"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Long Long"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Char"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Short"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Int"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Long Long"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Float"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + //hipResetDefaultAccelerator(); if(errors == 1){ passed(); - return 0; + }else{ + std::cout<<"Failed Float"< Date: Thu, 21 Apr 2016 14:51:19 -0500 Subject: [PATCH 70/82] reorg make_datatype feature --- include/hcc_detail/hip_vector_types.h | 69 ++++- src/device_util.cpp | 32 +++ tests/src/hip_test_make_type.cpp | 393 ++++++++++++++++++++++++++ 3 files changed, 493 insertions(+), 1 deletion(-) create mode 100644 tests/src/hip_test_make_type.cpp diff --git a/include/hcc_detail/hip_vector_types.h b/include/hcc_detail/hip_vector_types.h index f18bad8b89..c2f7a4796a 100644 --- a/include/hcc_detail/hip_vector_types.h +++ b/include/hcc_detail/hip_vector_types.h @@ -115,7 +115,74 @@ typedef hc::short_vector::double2 double2; typedef hc::short_vector::double3 double3; typedef hc::short_vector::double4 double4; +#if __HCC__ +#include"host_defines.h" +#define __HIP_DEVICE__ __device__ __host__ +#else +#define __HIP_DEVICE__ +#endif +__HIP_DEVICE__ char1 make_char1(signed char ); +__HIP_DEVICE__ char2 make_char2(signed char, signed char ); +__HIP_DEVICE__ char3 make_char3(signed char, signed char, signed char ); +__HIP_DEVICE__ char4 make_char4(signed char, signed char, signed char, signed char ); + +__HIP_DEVICE__ short1 make_short1(short ); +__HIP_DEVICE__ short2 make_short2(short, short ); +__HIP_DEVICE__ short3 make_short3(short, short, short ); +__HIP_DEVICE__ short4 make_short4(short, short, short, short ); + +__HIP_DEVICE__ int1 make_int1(int ); +__HIP_DEVICE__ int2 make_int2(int, int ); +__HIP_DEVICE__ int3 make_int3(int, int, int ); +__HIP_DEVICE__ int4 make_int4(int, int, int, int ); + +__HIP_DEVICE__ long1 make_long1(long ); +__HIP_DEVICE__ long2 make_long2(long, long ); +__HIP_DEVICE__ long3 make_long3(long, long, long ); +__HIP_DEVICE__ long4 make_long4(long, long, long, long ); + +__HIP_DEVICE__ longlong1 make_longlong1(long long ); +__HIP_DEVICE__ longlong2 make_longlong2(long long, long long ); +__HIP_DEVICE__ longlong3 make_longlong3(long long, long long, long long ); +__HIP_DEVICE__ longlong4 make_longlong4(long long, long long, long long, long long ); + +__HIP_DEVICE__ uchar1 make_uchar1(unsigned char ); +__HIP_DEVICE__ uchar2 make_uchar2(unsigned char, unsigned char ); +__HIP_DEVICE__ uchar3 make_uchar3(unsigned char, unsigned char, unsigned char ); +__HIP_DEVICE__ uchar4 make_uchar4(unsigned char, unsigned char, unsigned char, unsigned char ); + +__HIP_DEVICE__ ushort1 make_ushort1(unsigned short ); +__HIP_DEVICE__ ushort2 make_ushort2(unsigned short, unsigned short ); +__HIP_DEVICE__ ushort3 make_ushort3(unsigned short, unsigned short, unsigned short ); +__HIP_DEVICE__ ushort4 make_ushort4(unsigned short, unsigned short, unsigned short, unsigned short ); + +__HIP_DEVICE__ uint1 make_uint1(unsigned int ); +__HIP_DEVICE__ uint2 make_uint2(unsigned int, unsigned int ); +__HIP_DEVICE__ uint3 make_uint3(unsigned int, unsigned int, unsigned int ); +__HIP_DEVICE__ uint4 make_uint4(unsigned int, unsigned int, unsigned int, unsigned int ); + +__HIP_DEVICE__ ulong1 make_ulong1(unsigned long ); +__HIP_DEVICE__ ulong2 make_ulong2(unsigned long, unsigned long ); +__HIP_DEVICE__ ulong3 make_ulong3(unsigned long, unsigned long, unsigned long ); +__HIP_DEVICE__ ulong4 make_ulong4(unsigned long, unsigned long, unsigned long, unsigned long ); + +__HIP_DEVICE__ ulonglong1 make_ulonglong1(unsigned long long ); +__HIP_DEVICE__ ulonglong2 make_ulonglong2(unsigned long long, unsigned long long); +__HIP_DEVICE__ ulonglong3 make_ulonglong3(unsigned long long, unsigned long long, unsigned long long); +__HIP_DEVICE__ ulonglong4 make_ulonglong4(unsigned long long, unsigned long long, unsigned long long, unsigned long long ); + +__HIP_DEVICE__ float1 make_float1(float ); +__HIP_DEVICE__ float2 make_float2(float, float ); +__HIP_DEVICE__ float3 make_float3(float, float, float ); +__HIP_DEVICE__ float4 make_float4(float, float, float, float ); + +__HIP_DEVICE__ double1 make_double1(double ); +__HIP_DEVICE__ double2 make_double2(double, double ); +__HIP_DEVICE__ double3 make_double3(double, double, double ); +__HIP_DEVICE__ double4 make_double4(double, double, double, double ); + +/* ///--- // Inline functions for creating vector types from basic types #define ONE_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x) { VT t; t.x = x; return t; }; @@ -198,7 +265,7 @@ ONE_COMPONENT_ACCESS (double, double1); TWO_COMPONENT_ACCESS (double, double2); THREE_COMPONENT_ACCESS(double, double3); FOUR_COMPONENT_ACCESS (double, double4); - +*/ #endif diff --git a/src/device_util.cpp b/src/device_util.cpp index 8a99282cc1..d577cb291b 100644 --- a/src/device_util.cpp +++ b/src/device_util.cpp @@ -799,4 +799,36 @@ __device__ float __dsqrt_rn(double x) {return hc::fast_math::sqrt(x); }; __device__ float __dsqrt_ru(double x) {return hc::fast_math::sqrt(x); }; __device__ float __dsqrt_rz(double x) {return hc::fast_math::sqrt(x); }; +__HIP_DEVICE__ char1 make_char1(signed char x) +{ + char1 c1; + c1.x = x; + return c1; +} +__HIP_DEVICE__ char2 make_char2(signed char x, signed char y) +{ + char2 c2; + c2.x = x; + c2.y = y; + return c2; +} + +__HIP_DEVICE__ char3 make_char3(signed char x, signed char y, signed char z) +{ + char3 c3; + c3.x = x; + c3.y = y; + c3.z = z; + return c3; +} + +__HIP_DEVICE__ char4 make_char4(signed char x, signed char y, signed char z, signed char w) +{ + char4 c4; + c4.x = x; + c4.y = y; + c4.z = z; + c4.w = w; + return c4; +} diff --git a/tests/src/hip_test_make_type.cpp b/tests/src/hip_test_make_type.cpp new file mode 100644 index 0000000000..dec87ec712 --- /dev/null +++ b/tests/src/hip_test_make_type.cpp @@ -0,0 +1,393 @@ +/* +Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +#include +#include +#include +#include +#include +#include "hip_runtime.h" +#include "test_common.h" + +#define HIP_ASSERT(x) (assert((x)==hipSuccess)) + + +#define WIDTH 8 +#define HEIGHT 8 + +#define NUM (WIDTH*HEIGHT) + +#define THREADS_PER_BLOCK_X 8 +#define THREADS_PER_BLOCK_Y 8 +#define THREADS_PER_BLOCK_Z 1 + + +__global__ void +vectoradd_char1(hipLaunchParm lp, + char1* a, const char1* bm, const char1* cm, int width, int height) + + { + int x = hipBlockDim_x * hipBlockIdx_x + hipThreadIdx_x; + int y = hipBlockDim_y * hipBlockIdx_y + hipThreadIdx_y; + + int i = y * width + x; + if ( i < (width * height)) { + a[i] = make_char1(bm[i].x) + make_char1(cm[i].x); + } + } + +__global__ void +vectoradd_char2(hipLaunchParm lp, + char2* a, const char2* bm, const char2* cm, int width, int height) + + { + int x = hipBlockDim_x * hipBlockIdx_x + hipThreadIdx_x; + int y = hipBlockDim_y * hipBlockIdx_y + hipThreadIdx_y; + + int i = y * width + x; + if ( i < (width * height)) { + a[i] = make_char2(bm[i].x, bm[i].y) + make_char2(cm[i].x, cm[i].y); + } +} + +__global__ void +vectoradd_char3(hipLaunchParm lp, + char3* a, const char3* bm, const char3* cm, int width, int height) + + { + int x = hipBlockDim_x * hipBlockIdx_x + hipThreadIdx_x; + int y = hipBlockDim_y * hipBlockIdx_y + hipThreadIdx_y; + + int i = y * width + x; + if ( i < (width * height)) { + a[i] = make_char3(bm[i].x, bm[i].y, bm[i].z) + make_char3(cm[i].x, cm[i].y, cm[i].z); + } +} +__global__ void +vectoradd_char4(hipLaunchParm lp, + char4* a, const char4* bm, const char4* cm, int width, int height) + + { + int x = hipBlockDim_x * hipBlockIdx_x + hipThreadIdx_x; + int y = hipBlockDim_y * hipBlockIdx_y + hipThreadIdx_y; + + int i = y * width + x; + if ( i < (width * height)) { + a[i] = make_char4(bm[i].x, bm[i].y, bm[i].z, bm[i].w) + make_char4(cm[i].x, cm[i].y, cm[i].z, cm[i].w); + } +} + + +#if 0 +__kernel__ void vectoradd_float(float* a, const float* b, const float* c, int width, int height) { + + + int x = blockDimX * blockIdx.x + threadIdx.x; + int y = blockDimY * blockIdy.y + threadIdx.y; + + int i = y * width + x; + if ( i < (width * height)) { + a[i] = b[i] + c[i]; + } +} +#endif + +using namespace std; + +template +bool dataTypesRun(){ + T* hostA; + T* hostB; + T* hostC; + + T* deviceA; + T* deviceB; + T* deviceC; + + int i; + int errors; + + hostA = (T*)malloc(NUM * sizeof(T)); + hostB = (T*)malloc(NUM * sizeof(T)); + hostC = (T*)malloc(NUM * sizeof(T)); + + // initialize the input data + for (i = 0; i < NUM; i++) { + hostB[i] = (T)i; + hostC[i] = (T)i; + } + + HIP_ASSERT(hipMalloc((void**)&deviceA, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceC, NUM * sizeof(T))); + + HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(T), hipMemcpyHostToDevice)); + HIP_ASSERT(hipMemcpy(deviceC, hostC, NUM*sizeof(T), hipMemcpyHostToDevice)); + + hipLaunchKernel(HIP_KERNEL_NAME(vectoradd_char1), + dim3(WIDTH/THREADS_PER_BLOCK_X, HEIGHT/THREADS_PER_BLOCK_Y), + dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), + 0, 0, + deviceA ,deviceB ,deviceC ,WIDTH ,HEIGHT); + + HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(T), hipMemcpyDeviceToHost)); + + bool ret = false; + // verify the results + errors = 0; + for (i = 0; i < NUM; i++) { + if (hostA[i] != (hostB[i] + hostC[i])) { + errors++; + } + } + if (errors!=0) { + printf("FAILED: %d errors\n",errors); + ret = false; + } else { + ret = true; + } + + HIP_ASSERT(hipFree(deviceA)); + HIP_ASSERT(hipFree(deviceB)); + HIP_ASSERT(hipFree(deviceC)); + + free(hostA); + free(hostB); + free(hostC); + + return ret; +} + +template +bool dataTypesRun(){ + T* hostA; + T* hostB; + T* hostC; + + T* deviceA; + T* deviceB; + T* deviceC; + + int i; + int errors; + + hostA = (T*)malloc(NUM * sizeof(T)); + hostB = (T*)malloc(NUM * sizeof(T)); + hostC = (T*)malloc(NUM * sizeof(T)); + + // initialize the input data + for (i = 0; i < NUM; i++) { + hostB[i] = (T)i; + hostC[i] = (T)i; + } + + HIP_ASSERT(hipMalloc((void**)&deviceA, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceC, NUM * sizeof(T))); + + HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(T), hipMemcpyHostToDevice)); + HIP_ASSERT(hipMemcpy(deviceC, hostC, NUM*sizeof(T), hipMemcpyHostToDevice)); + + hipLaunchKernel(HIP_KERNEL_NAME(vectoradd_char1), + dim3(WIDTH/THREADS_PER_BLOCK_X, HEIGHT/THREADS_PER_BLOCK_Y), + dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), + 0, 0, + deviceA ,deviceB ,deviceC ,WIDTH ,HEIGHT); + + HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(T), hipMemcpyDeviceToHost)); + + bool ret = false; + // verify the results + errors = 0; + for (i = 0; i < NUM; i++) { + if (hostA[i] != (hostB[i] + hostC[i])) { + errors++; + } + } + if (errors!=0) { + printf("FAILED: %d errors\n",errors); + ret = false; + } else { + ret = true; + } + + HIP_ASSERT(hipFree(deviceA)); + HIP_ASSERT(hipFree(deviceB)); + HIP_ASSERT(hipFree(deviceC)); + + free(hostA); + free(hostB); + free(hostC); + + return ret; +} + +template +bool dataTypesRun(){ + T* hostA; + T* hostB; + T* hostC; + + T* deviceA; + T* deviceB; + T* deviceC; + + int i; + int errors; + + hostA = (T*)malloc(NUM * sizeof(T)); + hostB = (T*)malloc(NUM * sizeof(T)); + hostC = (T*)malloc(NUM * sizeof(T)); + + // initialize the input data + for (i = 0; i < NUM; i++) { + hostB[i] = (T)i; + hostC[i] = (T)i; + } + + HIP_ASSERT(hipMalloc((void**)&deviceA, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceC, NUM * sizeof(T))); + + HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(T), hipMemcpyHostToDevice)); + HIP_ASSERT(hipMemcpy(deviceC, hostC, NUM*sizeof(T), hipMemcpyHostToDevice)); + + hipLaunchKernel(HIP_KERNEL_NAME(vectoradd_char1), + dim3(WIDTH/THREADS_PER_BLOCK_X, HEIGHT/THREADS_PER_BLOCK_Y), + dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), + 0, 0, + deviceA ,deviceB ,deviceC ,WIDTH ,HEIGHT); + + HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(T), hipMemcpyDeviceToHost)); + + bool ret = false; + // verify the results + errors = 0; + for (i = 0; i < NUM; i++) { + if (hostA[i] != (hostB[i] + hostC[i])) { + errors++; + } + } + if (errors!=0) { + printf("FAILED: %d errors\n",errors); + ret = false; + } else { + ret = true; + } + + HIP_ASSERT(hipFree(deviceA)); + HIP_ASSERT(hipFree(deviceB)); + HIP_ASSERT(hipFree(deviceC)); + + free(hostA); + free(hostB); + free(hostC); + + return ret; +} + +bool dataTypesRunChar4(){ + char4* hostA; + char4* hostB; + char4* hostC; + + char4* deviceA; + char4* deviceB; + char4* deviceC; + + int i; + int errors; + + hostA = (T*)malloc(NUM * sizeof(T)); + hostB = (T*)malloc(NUM * sizeof(T)); + hostC = (T*)malloc(NUM * sizeof(T)); + + // initialize the input data + for (i = 0; i < NUM; i++) { + hostB[i] = (T)i; + hostC[i] = (T)i; + } + + HIP_ASSERT(hipMalloc((void**)&deviceA, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceB, NUM * sizeof(T))); + HIP_ASSERT(hipMalloc((void**)&deviceC, NUM * sizeof(T))); + + HIP_ASSERT(hipMemcpy(deviceB, hostB, NUM*sizeof(T), hipMemcpyHostToDevice)); + HIP_ASSERT(hipMemcpy(deviceC, hostC, NUM*sizeof(T), hipMemcpyHostToDevice)); + + hipLaunchKernel(HIP_KERNEL_NAME(vectoradd_char1), + dim3(WIDTH/THREADS_PER_BLOCK_X, HEIGHT/THREADS_PER_BLOCK_Y), + dim3(THREADS_PER_BLOCK_X, THREADS_PER_BLOCK_Y), + 0, 0, + deviceA ,deviceB ,deviceC ,WIDTH ,HEIGHT); + + HIP_ASSERT(hipMemcpy(hostA, deviceA, NUM*sizeof(T), hipMemcpyDeviceToHost)); + + bool ret = false; + // verify the results + errors = 0; + for (i = 0; i < NUM; i++) { + if (hostA[i] != (hostB[i] + hostC[i])) { + errors++; + } + } + if (errors!=0) { + printf("FAILED: %d errors\n",errors); + ret = false; + } else { + ret = true; + } + + HIP_ASSERT(hipFree(deviceA)); + HIP_ASSERT(hipFree(deviceB)); + HIP_ASSERT(hipFree(deviceC)); + + free(hostA); + free(hostB); + free(hostC); + + return ret; +} + +int main() { + + hipDeviceProp_t devProp; + hipGetDeviceProperties(&devProp, 0); + cout << " System minor " << devProp.minor << endl; + cout << " System major " << devProp.major << endl; + cout << " agent prop name " << devProp.name << endl; + + int errors; + + errors = dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + + //hipResetDefaultAccelerator(); + if(errors == 1){ + passed(); + }else{ + std::cout<<"Failed Float"< Date: Thu, 21 Apr 2016 17:25:30 -0500 Subject: [PATCH 71/82] added full make_datatype support --- src/device_util.cpp | 376 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 376 insertions(+) diff --git a/src/device_util.cpp b/src/device_util.cpp index d577cb291b..a5ad8db12a 100644 --- a/src/device_util.cpp +++ b/src/device_util.cpp @@ -832,3 +832,379 @@ __HIP_DEVICE__ char4 make_char4(signed char x, signed char y, signed char z, sig c4.w = w; return c4; } + +__HIP_DEVICE__ short1 make_short1(short x) +{ + short1 s1; + s1.x = x; + return s1; +} + +__HIP_DEVICE__ short2 make_short2(short x, short y) +{ + short2 s2; + s2.x = x; + s2.y = y; + return s2; +} + +__HIP_DEVICE__ short3 make_short3(short x, short y, short z) +{ + short3 s3; + s3.x = x; + s3.y = y; + s3.z = z; + return s3; +} + +__HIP_DEVICE__ short4 make_short4(short x, short y, short z, short w) +{ + short4 s4; + s4.x = x; + s4.y = y; + s4.z = z; + s4.w = w; + return s4; +} + +__HIP_DEVICE__ int1 make_int1(int x) +{ + int1 i1; + i1.x = x; + return i1; +} + +__HIP_DEVICE__ int2 make_int2(int x, int y) +{ + int2 i2; + i2.x = x; + i2.y = y; + return i2; +} + +__HIP_DEVICE__ int3 make_int3(int x, int y, int z) +{ + int3 i3; + i3.x = x; + i3.y = y; + i3.z = z; + return i3; +} + +__HIP_DEVICE__ int4 make_int4(int x, int y, int z, int w) +{ + int4 i4; + i4.x = x; + i4.y = y; + i4.z = z; + i4.w = w; + return i4; +} + +__HIP_DEVICE__ long1 make_long1(long x) +{ + long1 l1; + l1.x = x; + return l1; +} + +__HIP_DEVICE__ long2 make_long2(long x, long y) +{ + long2 l2; + l2.x = x; + l2.y = y; + return l2; +} + +__HIP_DEVICE__ long3 make_long3(long x, long y, long z) +{ + long3 l3; + l3.x = x; + l3.y = y; + l3.z = z; + return l3; +} + +__HIP_DEVICE__ long4 make_long4(long x, long y, long z, long w) +{ + long4 l4; + l4.x = x; + l4.y = y; + l4.z = z; + l4.w = w; + return l4; +} + +__HIP_DEVICE__ longlong1 make_longlong1(long long x) +{ + longlong1 l1; + l1.x = x; + return l1; +} + +__HIP_DEVICE__ longlong2 make_longlong2(long long x, long long y) +{ + longlong2 l2; + l2.x = x; + l2.y = y; + return l2; +} + +__HIP_DEVICE__ longlong3 make_longlong3(long long x, long long y, long long z) +{ + longlong3 l3; + l3.x = x; + l3.y = y; + l3.z = z; + return l3; +} + +__HIP_DEVICE__ longlong4 make_longlong4(long long x, long long y, long long z, long long w) +{ + longlong4 l4; + l4.x = x; + l4.y = y; + l4.z = z; + l4.w = w; + return l4; +} + +__HIP_DEVICE__ uchar1 make_uchar1(unsigned char x) +{ + uchar1 c1; + c1.x = x; + return c1; +} + +__HIP_DEVICE__ uchar2 make_uchar2(unsigned char x, unsigned char y) +{ + uchar2 c2; + c2.x = x; + c2.y = y; + return c2; +} + +__HIP_DEVICE__ uchar3 make_uchar3(unsigned char x, unsigned char y, unsigned char z) +{ + uchar3 c3; + c3.x = x; + c3.y = y; + c3.z = z; + return c3; +} + +__HIP_DEVICE__ uchar4 make_uchar4(unsigned char x, unsigned char y, unsigned char z, unsigned char w) +{ + uchar4 c4; + c4.x = x; + c4.y = y; + c4.z = z; + c4.w = w; + return c4; +} + +__HIP_DEVICE__ ushort1 make_ushort1(unsigned short x) +{ + ushort1 s1; + s1.x = x; + return s1; +} + +__HIP_DEVICE__ ushort2 make_ushort2(unsigned short x, unsigned short y) +{ + ushort2 s2; + s2.x = x; + s2.y = y; + return s2; +} + +__HIP_DEVICE__ ushort3 make_ushort3(unsigned short x, unsigned short y, unsigned short z) +{ + ushort3 s3; + s3.x = x; + s3.y = y; + s3.z = z; + return s3; +} + +__HIP_DEVICE__ ushort4 make_ushort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w) +{ + ushort4 s4; + s4.x = x; + s4.y = y; + s4.z = z; + s4.w = w; + return s4; +} + +__HIP_DEVICE__ uint1 make_uint1(unsigned int x) +{ + uint1 i1; + i1.x = x; + return i1; +} + +__HIP_DEVICE__ uint2 make_uint2(unsigned int x, unsigned int y) +{ + uint2 i2; + i2.x = x; + i2.y = y; + return i2; +} + +__HIP_DEVICE__ uint3 make_uint3(unsigned int x, unsigned int y, unsigned int z) +{ + uint3 i3; + i3.x = x; + i3.y = y; + i3.z = z; + return i3; +} + +__HIP_DEVICE__ uint4 make_uint4(unsigned int x, unsigned int y, unsigned int z, unsigned int w) +{ + uint4 i4; + i4.x = x; + i4.y = y; + i4.z = z; + i4.w = w; + return i4; +} + +__HIP_DEVICE__ ulong1 make_ulong1(unsigned long x) +{ + ulong1 l1; + l1.x = x; + return l1; +} + +__HIP_DEVICE__ ulong2 make_ulong2(unsigned long x, unsigned long y) +{ + ulong2 l2; + l2.x = x; + l2.y = y; + return l2; +} + +__HIP_DEVICE__ ulong3 make_ulong3(unsigned long x, unsigned long y, unsigned long z) +{ + ulong3 l3; + l3.x = x; + l3.y = y; + l3.z = z; + return l3; +} + +__HIP_DEVICE__ ulong4 make_ulong4(unsigned long x, unsigned long y, unsigned long z, unsigned long w) +{ + ulong4 l4; + l4.x = x; + l4.y = y; + l4.z = z; + l4.w = w; + return l4; +} + +__HIP_DEVICE__ ulonglong1 make_ulonglong1(unsigned long long x) +{ + ulonglong1 l1; + l1.x = x; + return l1; +} + +__HIP_DEVICE__ ulonglong2 make_ulonglong2(unsigned long long x, unsigned long long y) +{ + ulonglong2 l2; + l2.x = x; + l2.y = y; + return l2; +} + +__HIP_DEVICE__ ulonglong3 make_ulonglong3(unsigned long long x, unsigned long long y, unsigned long long z) +{ + ulonglong3 l3; + l3.x = x; + l3.y = y; + l3.z = z; + return l3; +} + +__HIP_DEVICE__ ulonglong4 make_ulonglong4(unsigned long long x, unsigned long long y, unsigned long long z, unsigned long long w) +{ + ulonglong4 l4; + l4.x = x; + l4.y = y; + l4.z = z; + l4.w = w; + return l4; +} + +__HIP_DEVICE__ float1 make_float1(float x) +{ + float1 f1; + f1.x = x; + return f1; +} + +__HIP_DEVICE__ float2 make_float2(float x, float y) +{ + float2 f2; + f2.x = x; + f2.y = y; + return f2; +} + +__HIP_DEVICE__ float3 make_float3(float x, float y, float z) +{ + float3 f3; + f3.x = x; + f3.y = y; + f3.z = z; + return f3; +} + +__HIP_DEVICE__ float4 make_float4(float x, float y, float z, float w) +{ + float4 f4; + f4.x = x; + f4.y = y; + f4.z = z; + f4.w = w; + return f4; +} + +__HIP_DEVICE__ double1 make_double1(double x) +{ + double1 d1; + d1.x = x; + return d1; +} + +__HIP_DEVICE__ double2 make_double2(double x, double y) +{ + double2 d2; + d2.x = x; + d2.y = y; + return d2; +} + +__HIP_DEVICE__ double3 make_double3(double x, double y, double z) +{ + double3 d3; + d3.x = x; + d3.y = y; + d3.z = z; + return d3; +} + +__HIP_DEVICE__ double4 make_double4(double x, double y, double z, double w) +{ + double4 d4; + d4.x = x; + d4.y = y; + d4.z = z; + d4.w = w; + return d4; +} + + From 75532471b2d124c4af823e838bf983a20debe6c4 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Fri, 22 Apr 2016 11:12:00 +0530 Subject: [PATCH 72/82] Revert "added full data type support for __ldg" This reverts commit ba59ea87ab60757c36a96a84e71397748ad64f27. Conflicts: include/hcc_detail/hip_ldg.h --- src/hip_ldg.cpp | 281 ++----------------------------------- tests/src/hip_test_ldg.cpp | 149 +------------------- 2 files changed, 18 insertions(+), 412 deletions(-) diff --git a/src/hip_ldg.cpp b/src/hip_ldg.cpp index f59c3e962d..1e35a5cd49 100644 --- a/src/hip_ldg.cpp +++ b/src/hip_ldg.cpp @@ -19,300 +19,43 @@ THE SOFTWARE. #include"hcc_detail/hip_ldg.h" -__device__ char __ldg(const char* ptr) +__device__ char __ldg(const char* ptr) +{ + return *ptr; +} + +__device__ signed char __ldg(const signed char* ptr) { return ptr[0]; } -__device__ char1 __ldg(const char1* ptr) +__device__ short __ldg(const short* ptr) { return ptr[0]; } -__device__ char2 __ldg(const char2* ptr) +__device__ int __ldg(const int* ptr) { return ptr[0]; } -__device__ char3 __ldg(const char3* ptr) -{ - return ptr[0]; -} - -__device__ char4 __ldg(const char4* ptr) -{ - return ptr[0]; -} - -__device__ signed char __ldg(const signed char* ptr) -{ - return ptr[0]; -} - -__device__ unsigned char __ldg(const unsigned char* ptr) +__device__ long long __ldg(const long long* ptr) { return ptr[0]; } -__device__ short __ldg(const short* ptr) +__device__ int2 __ldg(const int2* ptr) { return ptr[0]; } -__device__ short1 __ldg(const short1* ptr) +__device__ int4 __ldg(const int4* ptr) { return ptr[0]; } -__device__ short2 __ldg(const short2* ptr) +__device__ float __ldg(const float* ptr) { return ptr[0]; } - -__device__ short3 __ldg(const short3* ptr) -{ - return ptr[0]; -} - -__device__ short4 __ldg(const short4* ptr) -{ - return ptr[0]; -} - -__device__ unsigned short __ldg(const unsigned short* ptr) -{ - return ptr[0]; -} - - -__device__ int __ldg(const int* ptr) -{ - return ptr[0]; -} - -__device__ int1 __ldg(const int1* ptr) -{ - return ptr[0]; -} - -__device__ int2 __ldg(const int2* ptr) -{ - return ptr[0]; -} - -__device__ int3 __ldg(const int3* ptr) -{ - return ptr[0]; -} - -__device__ int4 __ldg(const int4* ptr) -{ - return ptr[0]; -} - -__device__ unsigned int __ldg(const unsigned int* ptr) -{ - return ptr[0]; -} - - -__device__ long __ldg(const long* ptr) -{ - return ptr[0]; -} - -__device__ long1 __ldg(const long1* ptr) -{ - return ptr[0]; -} - -__device__ long2 __ldg(const long2* ptr) -{ - return ptr[0]; -} - -__device__ long3 __ldg(const long3* ptr) -{ - return ptr[0]; -} - -__device__ long4 __ldg(const long4* ptr) -{ - return ptr[0]; -} - -__device__ unsigned long __ldg(const unsigned long* ptr) -{ - return ptr[0]; -} - - -__device__ long long __ldg(const long long* ptr) -{ - return ptr[0]; -} - -__device__ longlong1 __ldg(const longlong1* ptr) -{ - return ptr[0]; -} - -__device__ longlong2 __ldg(const longlong2* ptr) -{ - return ptr[0]; -} - -__device__ longlong3 __ldg(const longlong3* ptr) -{ - return ptr[0]; -} - -__device__ longlong4 __ldg(const longlong4* ptr) -{ - return ptr[0]; -} - -__device__ unsigned long long __ldg(const unsigned long long* ptr) -{ - return ptr[0]; -} - - -__device__ uchar1 __ldg(const uchar1* ptr) -{ - return ptr[0]; -} - -__device__ uchar2 __ldg(const uchar2* ptr) -{ - return ptr[0]; -} - -__device__ uchar3 __ldg(const uchar3* ptr) -{ - return ptr[0]; -} - -__device__ uchar4 __ldg(const uchar4* ptr) -{ - return ptr[0]; -} - - -__device__ ushort1 __ldg(const ushort1* ptr) -{ - return ptr[0]; -} - -__device__ ushort2 __ldg(const ushort2* ptr) -{ - return ptr[0]; -} - -__device__ ushort3 __ldg(const ushort3* ptr) -{ - return ptr[0]; -} - -__device__ ushort4 __ldg(const ushort4* ptr) -{ - return ptr[0]; -} - - -__device__ uint1 __ldg(const uint1* ptr) -{ - return ptr[0]; -} - -__device__ uint2 __ldg(const uint2* ptr) -{ - return ptr[0]; -} - -__device__ uint3 __ldg(const uint3* ptr) -{ - return ptr[0]; -} - -__device__ uint4 __ldg(const uint4* ptr) -{ - return ptr[0]; -} - - -__device__ ulonglong1 __ldg(const ulonglong1* ptr) -{ - return ptr[0]; -} - -__device__ ulonglong2 __ldg(const ulonglong2* ptr) -{ - return ptr[0]; -} - -__device__ ulonglong3 __ldg(const ulonglong3* ptr) -{ - return ptr[0]; -} - -__device__ ulonglong4 __ldg(const ulonglong4* ptr) -{ - return ptr[0]; -} - - -__device__ float __ldg(const float* ptr) -{ - return ptr[0]; -} - -__device__ float1 __ldg(const float1* ptr) -{ - return ptr[0]; -} - -__device__ float2 __ldg(const float2* ptr) -{ - return ptr[0]; -} - -__device__ float3 __ldg(const float3* ptr) -{ - return ptr[0]; -} - -__device__ float4 __ldg(const float4* ptr) -{ - return ptr[0]; -} - - -__device__ double __ldg(const double* ptr) -{ - return ptr[0]; -} - -__device__ double1 __ldg(const double1* ptr) -{ - return ptr[0]; -} - -__device__ double2 __ldg(const double2* ptr) -{ - return ptr[0]; -} - -__device__ double3 __ldg(const double3* ptr) -{ - return ptr[0]; -} - -__device__ double4 __ldg(const double4* ptr) -{ - return ptr[0]; -} - - - diff --git a/tests/src/hip_test_ldg.cpp b/tests/src/hip_test_ldg.cpp index 9d605fea5c..a58652d240 100644 --- a/tests/src/hip_test_ldg.cpp +++ b/tests/src/hip_test_ldg.cpp @@ -149,151 +149,14 @@ int main() { cout << " System major " << devProp.major << endl; cout << " agent prop name " << devProp.name << endl; - int errors; - - errors = dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Char"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Short"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Int"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Long"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Long Long"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Unsigned Char"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Unsigned Short"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Unsigned Int"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Unsigned Long Long"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - - if(errors == 1){ - errors = 0; - }else{ - std::cout<<"Failed Float"<() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - + int errors = dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); //hipResetDefaultAccelerator(); if(errors == 1){ passed(); - }else{ - std::cout<<"Failed Float"< Date: Fri, 22 Apr 2016 09:14:26 -0500 Subject: [PATCH 73/82] added workweek to hip_ldg --- include/hcc_detail/hip_ldg.h | 14 ++ src/hip_ldg.cpp | 295 +++++++++++++++++++++++++++++++++++ 2 files changed, 309 insertions(+) diff --git a/include/hcc_detail/hip_ldg.h b/include/hcc_detail/hip_ldg.h index 69ed0de823..4d128dbb02 100644 --- a/include/hcc_detail/hip_ldg.h +++ b/include/hcc_detail/hip_ldg.h @@ -21,10 +21,16 @@ THE SOFTWARE. #define HIP_LDG_H #if __HCC__ +<<<<<<< HEAD +#include"hip_vector_types.h" +#include"host_defines.h" +#if __hcc_workweek__ >= 16164 +======= #include"hip/hip_vector_types.h" #include"hip/hcc_detail/host_defines.h" +>>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 __device__ char __ldg(const char* ); __device__ char1 __ldg(const char1* ); __device__ char2 __ldg(const char2* ); @@ -94,6 +100,14 @@ __device__ double2 __ldg(const double2* ); __device__ double3 __ldg(const double3* ); __device__ double4 __ldg(const double4* ); +<<<<<<< HEAD +#endif // __hcc_workweek__ + +#endif // __HCC__ + +#endif // HIP_LDG_H +======= #endif #endif +>>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 diff --git a/src/hip_ldg.cpp b/src/hip_ldg.cpp index 1e35a5cd49..c376e0170a 100644 --- a/src/hip_ldg.cpp +++ b/src/hip_ldg.cpp @@ -18,6 +18,128 @@ THE SOFTWARE. */ #include"hcc_detail/hip_ldg.h" +<<<<<<< HEAD +#if __hcc_workweek__ >= 16164 +__device__ char __ldg(const char* ptr) +{ + return ptr[0]; +} + +__device__ char1 __ldg(const char1* ptr) +{ + return ptr[0]; +} + +__device__ char2 __ldg(const char2* ptr) +{ + return ptr[0]; +} + +__device__ char3 __ldg(const char3* ptr) +{ + return ptr[0]; +} + +__device__ char4 __ldg(const char4* ptr) +{ + return ptr[0]; +} + +__device__ signed char __ldg(const signed char* ptr) +{ + return ptr[0]; +} + +__device__ unsigned char __ldg(const unsigned char* ptr) +{ + return ptr[0]; +} + + +__device__ short __ldg(const short* ptr) +{ + return ptr[0]; +} + +__device__ short1 __ldg(const short1* ptr) +{ + return ptr[0]; +} + +__device__ short2 __ldg(const short2* ptr) +{ + return ptr[0]; +} + +__device__ short3 __ldg(const short3* ptr) +{ + return ptr[0]; +} + +__device__ short4 __ldg(const short4* ptr) +{ + return ptr[0]; +} + +__device__ unsigned short __ldg(const unsigned short* ptr) +{ + return ptr[0]; +} + + +__device__ int __ldg(const int* ptr) +{ + return ptr[0]; +} + +__device__ int1 __ldg(const int1* ptr) +{ + return ptr[0]; +} + +__device__ int2 __ldg(const int2* ptr) +{ + return ptr[0]; +} + +__device__ int3 __ldg(const int3* ptr) +{ + return ptr[0]; +} + +__device__ int4 __ldg(const int4* ptr) +{ + return ptr[0]; +} + +__device__ unsigned int __ldg(const unsigned int* ptr) +{ + return ptr[0]; +} + + +__device__ long __ldg(const long* ptr) +{ + return ptr[0]; +} + +__device__ long1 __ldg(const long1* ptr) +{ + return ptr[0]; +} + +__device__ long2 __ldg(const long2* ptr) +{ + return ptr[0]; +} + +__device__ long3 __ldg(const long3* ptr) +{ + return ptr[0]; +} + +__device__ long4 __ldg(const long4* ptr) +======= __device__ char __ldg(const char* ptr) { @@ -25,37 +147,210 @@ __device__ char __ldg(const char* ptr) } __device__ signed char __ldg(const signed char* ptr) +>>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } +<<<<<<< HEAD +__device__ unsigned long __ldg(const unsigned long* ptr) +======= __device__ short __ldg(const short* ptr) +>>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } +<<<<<<< HEAD + +__device__ long long __ldg(const long long* ptr) +======= __device__ int __ldg(const int* ptr) +>>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } +<<<<<<< HEAD +__device__ longlong1 __ldg(const longlong1* ptr) +======= __device__ long long __ldg(const long long* ptr) +>>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } +<<<<<<< HEAD +__device__ longlong2 __ldg(const longlong2* ptr) +{ + return ptr[0]; +} + +__device__ longlong3 __ldg(const longlong3* ptr) +======= __device__ int2 __ldg(const int2* ptr) +>>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } +<<<<<<< HEAD +__device__ longlong4 __ldg(const longlong4* ptr) +{ + return ptr[0]; +} + +__device__ unsigned long long __ldg(const unsigned long long* ptr) +{ + return ptr[0]; +} + + +__device__ uchar1 __ldg(const uchar1* ptr) +======= __device__ int4 __ldg(const int4* ptr) +>>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } +<<<<<<< HEAD +__device__ uchar2 __ldg(const uchar2* ptr) +{ + return ptr[0]; +} + +__device__ uchar3 __ldg(const uchar3* ptr) +{ + return ptr[0]; +} + +__device__ uchar4 __ldg(const uchar4* ptr) +{ + return ptr[0]; +} + + +__device__ ushort1 __ldg(const ushort1* ptr) +{ + return ptr[0]; +} + +__device__ ushort2 __ldg(const ushort2* ptr) +{ + return ptr[0]; +} + +__device__ ushort3 __ldg(const ushort3* ptr) +{ + return ptr[0]; +} + +__device__ ushort4 __ldg(const ushort4* ptr) +{ + return ptr[0]; +} + + +__device__ uint1 __ldg(const uint1* ptr) +{ + return ptr[0]; +} + +__device__ uint2 __ldg(const uint2* ptr) +{ + return ptr[0]; +} + +__device__ uint3 __ldg(const uint3* ptr) +{ + return ptr[0]; +} + +__device__ uint4 __ldg(const uint4* ptr) +{ + return ptr[0]; +} + + +__device__ ulonglong1 __ldg(const ulonglong1* ptr) +{ + return ptr[0]; +} + +__device__ ulonglong2 __ldg(const ulonglong2* ptr) +{ + return ptr[0]; +} + +__device__ ulonglong3 __ldg(const ulonglong3* ptr) +{ + return ptr[0]; +} + +__device__ ulonglong4 __ldg(const ulonglong4* ptr) +{ + return ptr[0]; +} + + +__device__ float __ldg(const float* ptr) +{ + return ptr[0]; +} + +__device__ float1 __ldg(const float1* ptr) +{ + return ptr[0]; +} + +__device__ float2 __ldg(const float2* ptr) +{ + return ptr[0]; +} + +__device__ float3 __ldg(const float3* ptr) +{ + return ptr[0]; +} + +__device__ float4 __ldg(const float4* ptr) +{ + return ptr[0]; +} + + +__device__ double __ldg(const double* ptr) +{ + return ptr[0]; +} + +__device__ double1 __ldg(const double1* ptr) +{ + return ptr[0]; +} + +__device__ double2 __ldg(const double2* ptr) +{ + return ptr[0]; +} + +__device__ double3 __ldg(const double3* ptr) +{ + return ptr[0]; +} + +__device__ double4 __ldg(const double4* ptr) +{ + return ptr[0]; +} + +#endif + +======= __device__ float __ldg(const float* ptr) { return ptr[0]; } +>>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 From ec23aba6f96fb1c8d53749259eb5f01c1ae2c2f9 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Fri, 22 Apr 2016 09:19:05 -0500 Subject: [PATCH 74/82] Fixed git spills --- include/hcc_detail/hip_ldg.h | 8 -------- src/hip_ldg.cpp | 39 +----------------------------------- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/include/hcc_detail/hip_ldg.h b/include/hcc_detail/hip_ldg.h index 4d128dbb02..4dab90b4e8 100644 --- a/include/hcc_detail/hip_ldg.h +++ b/include/hcc_detail/hip_ldg.h @@ -21,16 +21,13 @@ THE SOFTWARE. #define HIP_LDG_H #if __HCC__ -<<<<<<< HEAD #include"hip_vector_types.h" #include"host_defines.h" #if __hcc_workweek__ >= 16164 -======= #include"hip/hip_vector_types.h" #include"hip/hcc_detail/host_defines.h" ->>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 __device__ char __ldg(const char* ); __device__ char1 __ldg(const char1* ); __device__ char2 __ldg(const char2* ); @@ -100,14 +97,9 @@ __device__ double2 __ldg(const double2* ); __device__ double3 __ldg(const double3* ); __device__ double4 __ldg(const double4* ); -<<<<<<< HEAD #endif // __hcc_workweek__ #endif // __HCC__ #endif // HIP_LDG_H -======= -#endif -#endif ->>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 diff --git a/src/hip_ldg.cpp b/src/hip_ldg.cpp index c376e0170a..434c2efdc3 100644 --- a/src/hip_ldg.cpp +++ b/src/hip_ldg.cpp @@ -18,7 +18,6 @@ THE SOFTWARE. */ #include"hcc_detail/hip_ldg.h" -<<<<<<< HEAD #if __hcc_workweek__ >= 16164 __device__ char __ldg(const char* ptr) { @@ -139,63 +138,36 @@ __device__ long3 __ldg(const long3* ptr) } __device__ long4 __ldg(const long4* ptr) -======= - -__device__ char __ldg(const char* ptr) -{ - return *ptr; -} - -__device__ signed char __ldg(const signed char* ptr) ->>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } -<<<<<<< HEAD __device__ unsigned long __ldg(const unsigned long* ptr) -======= -__device__ short __ldg(const short* ptr) ->>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } -<<<<<<< HEAD __device__ long long __ldg(const long long* ptr) -======= -__device__ int __ldg(const int* ptr) ->>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } -<<<<<<< HEAD __device__ longlong1 __ldg(const longlong1* ptr) -======= -__device__ long long __ldg(const long long* ptr) ->>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } -<<<<<<< HEAD __device__ longlong2 __ldg(const longlong2* ptr) { return ptr[0]; } __device__ longlong3 __ldg(const longlong3* ptr) -======= - -__device__ int2 __ldg(const int2* ptr) ->>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } -<<<<<<< HEAD __device__ longlong4 __ldg(const longlong4* ptr) { return ptr[0]; @@ -208,14 +180,10 @@ __device__ unsigned long long __ldg(const unsigned long long* ptr) __device__ uchar1 __ldg(const uchar1* ptr) -======= -__device__ int4 __ldg(const int4* ptr) ->>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 { return ptr[0]; } -<<<<<<< HEAD __device__ uchar2 __ldg(const uchar2* ptr) { return ptr[0]; @@ -348,9 +316,4 @@ __device__ double4 __ldg(const double4* ptr) #endif -======= -__device__ float __ldg(const float* ptr) -{ - return ptr[0]; -} ->>>>>>> 75532471b2d124c4af823e838bf983a20debe6c4 + From 00b89fc33d1892ea6debd39d8173c1c1c8586005 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Fri, 22 Apr 2016 09:25:09 -0500 Subject: [PATCH 75/82] added hcc workweek to ldg test --- tests/src/hip_test_ldg.cpp | 154 +++++++++++++++++++++++++++++++++++-- 1 file changed, 148 insertions(+), 6 deletions(-) diff --git a/tests/src/hip_test_ldg.cpp b/tests/src/hip_test_ldg.cpp index a58652d240..31c7d4865a 100644 --- a/tests/src/hip_test_ldg.cpp +++ b/tests/src/hip_test_ldg.cpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include #include "hip_runtime.h" #include "test_common.h" - +#if __hcc_workweek__ >= 16164 #define HIP_ASSERT(x) (assert((x)==hipSuccess)) @@ -149,14 +149,156 @@ int main() { cout << " System major " << devProp.major << endl; cout << " agent prop name " << devProp.name << endl; - int errors = dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - //hipResetDefaultAccelerator(); + int errors; + + errors = dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Char"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Short"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Int"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Long"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Long Long"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Char"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Short"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Int"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Long Long"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Float"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + + //hipResetDefaultAccelerator(); if(errors == 1){ passed(); return 0; + }else{ + std::cout<<"Failed Float"< Date: Mon, 25 Apr 2016 14:42:35 -0500 Subject: [PATCH 76/82] Update with original --- include/hcc_detail/hip_ldg.h | 1 + tests/src/hip_test_ldg.cpp | 154 +++++++++++++++++++++++++++++++++-- 2 files changed, 149 insertions(+), 6 deletions(-) diff --git a/include/hcc_detail/hip_ldg.h b/include/hcc_detail/hip_ldg.h index e6fe45cd77..4dab90b4e8 100644 --- a/include/hcc_detail/hip_ldg.h +++ b/include/hcc_detail/hip_ldg.h @@ -102,3 +102,4 @@ __device__ double4 __ldg(const double4* ); #endif // __HCC__ #endif // HIP_LDG_H + diff --git a/tests/src/hip_test_ldg.cpp b/tests/src/hip_test_ldg.cpp index a58652d240..31c7d4865a 100644 --- a/tests/src/hip_test_ldg.cpp +++ b/tests/src/hip_test_ldg.cpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include #include "hip_runtime.h" #include "test_common.h" - +#if __hcc_workweek__ >= 16164 #define HIP_ASSERT(x) (assert((x)==hipSuccess)) @@ -149,14 +149,156 @@ int main() { cout << " System major " << devProp.major << endl; cout << " agent prop name " << devProp.name << endl; - int errors = dataTypesRun() & - dataTypesRun() & - dataTypesRun() & - dataTypesRun(); - //hipResetDefaultAccelerator(); + int errors; + + errors = dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Char"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Short"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Int"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Long"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Long Long"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Char"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Short"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Int"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Unsigned Long Long"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + if(errors == 1){ + errors = 0; + }else{ + std::cout<<"Failed Float"<() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun() & + dataTypesRun(); + + + //hipResetDefaultAccelerator(); if(errors == 1){ passed(); return 0; + }else{ + std::cout<<"Failed Float"< Date: Mon, 25 Apr 2016 15:13:23 -0500 Subject: [PATCH 77/82] add hostname --- bin/hipconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/hipconfig b/bin/hipconfig index 08fb6baade..49c385753d 100755 --- a/bin/hipconfig +++ b/bin/hipconfig @@ -97,9 +97,9 @@ if (!$printed or $p_full) { print ("HSA_PATH : $HSA_PATH\n"); print ("HCC_HOME : $HCC_HOME\n"); system("$HCC_HOME/bin/hcc --version"); - print ("HCC-cxxflags: "); + print ("HCC-cxxflags : "); system("$HCC_HOME/bin/hcc-config --cxxflags"); - print ("HCC-ldflags : "); + print ("HCC-ldflags : "); system("$HCC_HOME/bin/hcc-config --ldflags"); printf("\n"); } @@ -119,6 +119,7 @@ if (!$printed or $p_full) { print "\n" ; print "== Linux Kernel\n"; + print "Hostname : "; system ("hostname"); system ("uname -a"); if (-e "/usr/bin/lsb_release") { From db756823954b68e0a9731f12a0dce4ebf7eaec38 Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Wed, 27 Apr 2016 11:55:09 -0500 Subject: [PATCH 78/82] Add tip on making local HIP (mostly for HIP devs) --- CONTRIBUTING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3b07c0c0c5..473a14a143 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,18 @@ # Contributor Guidelines +## Make Tips +When building HIP, you will likely want to build and install to a local user-accessible directory (rather than /opt/rocm). +This can be easily be done by setting the -DCMAKE_INSTALL_PREFIX variable when running cmake. Typical use case is to +set CMAKE_INSTALL_PREFIX to your HIP git root, and then ensure HIP_PATH points to this directory. For example + +``` +cmake .. -DCMAKE_INSTALL_PREFIX=.. +make install + +export HIP_PATH= +``` + + ## Adding a new HIP API From 76a869562dc22c16aa9061fbf52c0e61115c5bf1 Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Wed, 27 Apr 2016 17:45:14 -0500 Subject: [PATCH 79/82] Doc update --- CONTRIBUTING.md | 2 ++ docs/markdown/hip_porting_guide.md | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 473a14a143..f6e578efd8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,8 @@ make install export HIP_PATH= ``` +After making HIP, don't forget the "make install" step ! + ## Adding a new HIP API diff --git a/docs/markdown/hip_porting_guide.md b/docs/markdown/hip_porting_guide.md index 6c12547c2d..b706262f71 100644 --- a/docs/markdown/hip_porting_guide.md +++ b/docs/markdown/hip_porting_guide.md @@ -8,7 +8,7 @@ and provides practical suggestions on how to port CUDA code and work through com * [HIP Porting Guide](#hip-porting-guide) * [Table of Contents](#table-of-contents) - * [Porting a New Cuda Project TO](#porting-a-new-cuda-project) + * [Porting a New Cuda Project To HIP](#porting-a-new-cuda-project) * [General Tips](#general-tips" aria-hidden="true"> Date: Mon, 2 May 2016 10:19:46 -0500 Subject: [PATCH 81/82] split INSTALL.md into separate file --- INSTALL.md | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 127 +---------------------------------- 2 files changed, 191 insertions(+), 125 deletions(-) create mode 100644 INSTALL.md diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000000..dccbee2995 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,189 @@ + + +**Installation** + +- [Installing pre-built packages:](#installing-pre-built-packages) + - [Prerequisites](#prerequisites) + - [AMD (hcc)](#amd-hcc) + - [NVIDIA (nvcc)](#nvidia-nvcc) + - [Verify your installation](#verify-your-installation) +- [Building HIP from source](#building-hip-from-source) + - [HCC Options](#hcc-options) + - [Using HIP with the AMD Native-GCN compiler.](#using-hip-with-the-amd-native-gcn-compiler) + - [Compiling CodeXL markers for HIP Functions](#compiling-codexl-markers-for-hip-functions) + - [Using clang-hipify](#using-clang-hipify) + - [Building](#building) + - [Running and using clang-hipify](#running-and-using-clang-hipify) + + + +# Installing pre-built packages + +HIP can be easily installed using pre-built binary packages using the package manager for your platform. + +## Prerequisites +HIP code can be developed either on AMD ROCm platform using hcc compiler, or a CUDA platform with nvcc installed: + +## AMD-hcc + +* Install the [rocm](http://gpuopen.com/getting-started-with-boltzmann-components-platforms-installation/) packages. Rocm will install all of the necessary components, including the kernel driver, runtime software, HCC compiler, and HIP. + +* Default paths and environment variables: + + * By default HIP looks for hcc in /opt/rocm/hcc (can be overridden by setting HCC_HOME environment variable) + * By default HIP looks for HSA in /opt/rocm/hsa (can be overridden by setting HSA_PATH environment variable) + * By default HIP is installed into /opt/rocm/hip (can be overridden by setting HIP_PATH environment variable). + * Optionally, consider adding /opt/rocm/bin to your path to make it easier to use the tools. + + +## NVIDIA-nvcc +* Configure the additional package server as described [here](http://gpuopen.com/getting-started-with-boltzmann-components-platforms-installation/). +* Install the "hip_nvcc" package. This will install CUDA SDK and the HIP porting layer. +``` +apt-get install hip_nvcc +``` + +* Default paths and environment variables: + * By default HIP looks for CUDA SDK in /usr/local/cuda (can be overriden by setting CUDA_PATH env variable) + * By default HIP is installed into /opt/rocm/hip (can be overridden by setting HIP_PATH environment variable). + * Optionally, consider adding /opt/rocm/bin to your path to make it easier to use the tools. + + +## Verify your installation +Run hipconfig (instructions below assume default installation path) : +```shell +/opt/rocm/bin/hipconfig --full +``` + +Compile and run the [square sample](https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/tree/master/samples/0_Intro/square). + + +# Building HIP from source +HIP source code is available and the project can be built from source on the HCC platform. + +1. Follow the above steps to install and validate the binary packages. +2. Download HIP source code (from the [GitHub repot](https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP).) +3. Build and install HIP (This is the simple version assuming default paths ; see below for additional options.) +``` +cd HIP-privatestaging +mkdir build +cd build +cmake .. +make +make install +``` + +* Default paths: + * By default cmake looks for hcc in /opt/rocm/hcc (can be overridden by setting ```-DHCC_HOME=/path/to/hcc``` in the cmake step).* + * By default cmake looks for HSA in /opt/rocm/hsa (can be overridden by setting ```-DHSA_PATH=/path/to/hsa``` in the cmake step).* + * By default cmake installs HIP to /opt/rocm/hip (can be overridden by setting ```-DCMAKE_INSTALL_PREFIX=/where/to/install/hip``` in the cmake step).* + +Here's a richer command-line that overrides the default paths: + +```shell +cd HIP-privatestaging +mkdir build +cd build +cmake -DHSA_PATH=/path/to/hsa -DHCC_HOME=/path/to/hcc -DCMAKE_INSTALL_PREFIX=/where/to/install/hip -DCMAKE_BUILD_TYPE=Release .. +make +make install +``` + +* After installation, make sure HIP_PATH is pointed to `/where/to/install/hip`. + +## HCC Options + +### Using HIP with the AMD Native-GCN compiler. +AMD recently released a direct-to-GCN-ISA target. This compiler generates GCN ISA directly from LLVM, without going through an intermediate compiler +IR such as HSAIL or PTX. +The native GCN target is included with upstream LLVM, and has also been integrated with HCC compiler and can be used to compiler HIP programs for AMD. +Binary packages for the direct-to-isa package are included with the [rocm](http://gpuopen.com/getting-started-with-boltzmann-components-platforms-installation/) package. +Alternatively, this sections describes how to build it from source: + +1. Install the rocm packages as described above. +2. Follow the instructions [here](https://github.com/RadeonOpenCompute/HCC-Native-GCN-ISA/wiki) + * In the make step for HCC, we recommend setting -DCMAKE_INSTALL_PREFIX. + * Set HCC_HOME environment variable before compiling HIP program to point to the native compiler: +```shell +export HCC_HOME=/path/to/native/hcc +``` + + +### Compiling CodeXL markers for HIP Functions +HIP can generate markers at function begin/end which are displayed on the CodeXL timeline view. To do this, you need to install CodeXL, tell HIP +where the CodeXL install directory lives, and enable HIP to generate the markers: + +1. Install CodeXL +See [CodeXL Download](http://developer.amd.com/tools-and-sdks/opencl-zone/codexl/?webSyncID=9d9c2cb9-3d73-5e65-268a-c7b06428e5e0&sessionGUID=29beacd0-d654-ddc6-a3e2-b9e6c0b0cc77) for the installation file. +Also this [blog](http://gpuopen.com/getting-up-to-speed-with-the-codexl-gpu-profiler-and-radeon-open-compute/) provides more information and tips for using CodeXL. In addition to installing the CodeXL profiling +and visualization tools, CodeXL also comes with an SDK that allow applications to add markers to the timeline viewer. We'll be linking HIP against this library. + +2. Set CODEXL_PATH +```shell +# set to your code-xl installation location: +export CODEXL_PATH=/opt/AMD/CodeXL +``` + +3. Enable in source code. +In src/hip_hcc.cpp, enable the define +```c +#define COMPILE_TRACE_MARKER 1 +``` + + +Then recompile the target application, run with profiler enabled to generate ATP file or trace log. +```shell +# Use profiler to generate timeline view: +$CODEXL_PATH/CodeXLGpuProfiler -A -o ./myHipApp +... +Session output path: /home/me/HIP-privatestaging/tests/b1/mytrace.atp +``` + +You can also print the HIP function strings to stderr using HIP_TRACE_API environment variable. This can be useful for tracing application flow. Also can be combined with the more detailed debug information provided +by the HIP_DB switch. For example: +```shell +# Trace to stderr showing begin/end of each function (with arguments) + intermediate debug trace during the execution of each function. +HIP_TRACE_API=1 HIP_DB=0x2 ./myHipApp +``` + +Note this trace mode uses colors. "less -r" can handle raw control characters and will display the debug output in proper colors. + + +### Using clang-hipify + +Clang-hipify is a clang-based tool which can automate the translation of CUDA source code into portable HIP C++. +The clang-hipify tool can automatically add extra HIP arguments (notably the "hipLaunchParm" required at the +beginning of every HIP kernel call). Clang-hipify has some additional dependencies explained below and +can be built as a separate make step. + + +#### Building + +1. Download and unpack clang+llvm 3.8 binary package preqrequisite: +``` +wget http://llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz +tar xvfJ clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz +``` + +2. Enable build of clang-hipify and specify path to LLVM: +Note LLVM_DIR must be a full absolute path (not relative) to the location extracted above. Here's an example assuming we +extract the clang 3.8 package into ~/HIP-privatestaging/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/. +``` +cd HIP-privatestaging +mkdir build.clang-hipify +cd build.clang-hipify +cmake -DBUILD_CLANG_HIPIFY=1 -DLLVM_DIR=~/HIP-privatestaging/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/ -DCMAKE_BUILD_TYPE=Release .. +make +make install +``` + +#### Running and using clang-hipify +clang-hipify performs an initial compile of the CUDA source code into a "symbol tree", and thus needs access to the appropriate header files: + 1. Download "deb(network)" variant of target installer from https://developer.nvidia.com/cuda-downloads. The commands below show how to download and install a recent version from the http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb. + +``` +wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb +sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb +sudo apt-get update && sudo apt-get install cuda-minimal-build-7-5 cuda-curand-dev-7-5 +``` + diff --git a/README.md b/README.md index 2244c656cd..116d74e197 100644 --- a/README.md +++ b/README.md @@ -10,32 +10,9 @@ Key features include: * Developers can specialize for the platform (CUDA or hcc) to tune for performance or handle tricky cases New projects can be developed directly in the portable HIP C++ language and can run on either NVIDIA or AMD platforms. Additionally, HIP provides porting tools which make it easy to port existing CUDA codes to the HIP layer, with no loss of performance as compared to the original CUDA application. HIP is not intended to be a drop-in replacement for CUDA, and developers should expect to do some manual coding and performance tuning work to complete the port. -## Installation -```shell -cd HIP-privatestaging -mkdir build -cd build -<<<<<<< HEAD -cmake .. -make -make install -``` -*By default cmake looks for hcc in /opt/rocm/hcc (can be overridden by setting ```-DHCC_HOME=/path/to/hcc``` in the cmake step).* - -*By default cmake looks for HSA in /opt/rocm/hsa (can be overridden by setting ```-DHSA_PATH=/path/to/hsa``` in the cmake step).* - -*By default cmake installs HIP to /opt/rocm/hip (can be overridden by setting ```-DCMAKE_INSTALL_PREFIX=/where/to/install/hip``` in the cmake step).* - -*Make sure HIP_PATH is pointed to `/where/to/install/hip` and PATH includes `$HIP_PATH/bin`. This requirement is optional, but required to run any HIP test infrastructure.* -======= -cmake -DHSA_PATH=/path/to/hsa -DHCC_HOME=/path/to/hcc -DCMAKE_INSTALL_PREFIX=/where/to/install/hip -DLLVM_DIR=/path/to/clang-llvm-3.8 -DCMAKE_BUILD_TYPE=Release .. -make -make install -``` -Make sure HIP_PATH is pointed to `/where/to/install/hip` and PATH includes `$HIP_PATH/bin`. This requirement is optional, but required to run any HIP test infrastructure. The path `/path/to/clang-llvm-3.8` should be specified for [clang-hipify](README.md#clang-hipify) utility build. ->>>>>>> clang-hipify ## More Info: +- [Installation](INSTALL.md) and [clang-hipify](INSTALL.md#use-clang-hipify.md) - [HIP FAQ](docs/markdown/hip_faq.md) - [HIP Kernel Language](docs/markdown/hip_kernel_language.md) - [HIP Runtime API (Doxygen)](http://gpuopen-professionalcompute-tools.github.io/HIP) @@ -47,108 +24,8 @@ Make sure HIP_PATH is pointed to `/where/to/install/hip` and PATH includes `$HIP ## How do I get set up? -### Prerequisites - Choose Your Platform -HIP code can be developed either on AMD ROCm platform using hcc compiler, or a CUDA platform with nvcc installed: +See the [Installation](INSTALL.md) notes. -#### AMD (hcc): - -* Install [hcc](https://bitbucket.org/multicoreware/hcc/wiki/Home) including supporting HSA kernel and runtime driver stack -* By default HIP looks for hcc in /opt/rocm/hcc (can be overridden by setting HCC_HOME environment variable) -* By default HIP looks for HSA in /opt/rocm/hsa (can be overridden by setting HSA_PATH environment variable) -* Ensure that ROCR runtime is installed and added to LD_LIBRARY_PATH -* Install HIP (from this GitHub repot). By default HIP is installed into /opt/rocm/hip (can be overridden by setting HIP_PATH environment variable). - -* Optionally, consider adding /opt/rocm/bin to your path to make it easier to use the tools. - - -#####clang-hipify -To build and run clang based hipify utiliy a set of CUDA headers and clang+llvm 3.8 binary package are required: -- download and install CUDA minimal prerequisites: - 1. Download "deb(network)" variant of target installer from https://developer.nvidia.com/cuda-downloads. E.g. at the moment the link is http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb - 2. install clang prerequisites with the following commands: -``` -wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb -sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb -sudo apt-get update && sudo apt-get install cuda-minimal-build-7-5 cuda-curand-dev-7-5 -``` -- download and unpack clang+llvm 3.8 binary package: -``` -wget http://llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz -tar xvfJ clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C /path/to/clang-llvm-3.8 -``` -#### NVIDIA (nvcc) -* Install CUDA SDK from manufacturer website -* By default HIP looks for CUDA SDK in /usr/local/cuda (can be overriden by setting CUDA_PATH env variable) -* Install HIP (from this GitHub repot). By default HIP is installed into /opt/rocm/hip (can be overridden by setting HIP_PATH environment variable). - -* Optionally, consider adding /opt/rocm/bin to your path to make it easier to use the tools. - -#### Verify your installation -Run hipconfig (instructions below assume default installation path) : -```shell -/opt/rocm/bin/hipconfig --full -``` - -Compile and run the [square sample](https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/tree/master/samples/0_Intro/square). - - - -### HCC Options - -#### Compiling CodeXL markers for HIP Functions -HIP can generate markers at function begin/end which are displayed on the CodeXL timeline view. To do this, you need to install CodeXL, tell HIP -where the CodeXL install directory lives, and enable HIP to generate the markers: - -1. Install CodeXL -See [CodeXL Download](http://developer.amd.com/tools-and-sdks/opencl-zone/codexl/?webSyncID=9d9c2cb9-3d73-5e65-268a-c7b06428e5e0&sessionGUID=29beacd0-d654-ddc6-a3e2-b9e6c0b0cc77) for the installation file. -Also this [blog](http://gpuopen.com/getting-up-to-speed-with-the-codexl-gpu-profiler-and-radeon-open-compute/) provides more information and tips for using CodeXL. In addition to installing the CodeXL profiling -and visualization tools, CodeXL also comes with an SDK that allow applications to add markers to the timeline viewer. We'll be linking HIP against this library. - -2. Set CODEXL_PATH -```shell -# set to your code-xl installation location: -export CODEXL_PATH=/opt/AMD/CodeXL -``` - -3. Enable in source code. -In src/hip_hcc.cpp, enable the define -```c -#define COMPILE_TRACE_MARKER 1 -``` - - -Then recompile the target application, run with profiler enabled to generate ATP file or trace log. -```shell -# Use profiler to generate timeline view: -$CODEXL_PATH/CodeXLGpuProfiler -A -o ./myHipApp -... -Session output path: /home/me/HIP-privatestaging/tests/b1/mytrace.atp -``` - -You can also print the HIP function strings to stderr using HIP_TRACE_API environment variable. This can be useful for tracing application flow. Also can be combined with the more detailed debug information provided -by the HIP_DB switch. For example: -```shell -# Trace to stderr showing begin/end of each function (with arguments) + intermediate debug trace during the execution of each function. -HIP_TRACE_API=1 HIP_DB=0x2 ./myHipApp -``` - -Note this trace mode uses colors. "less -r" can handle raw control characters and will display the debug output in proper colors. - - -#### Using HIP with the AMD Native-GCN compiler. -AMD recently released a direct-to-GCN-ISA target. This compiler generates GCN ISA directly from LLVM, without going through an intermediate compiler -IR such as HSAIL or PTX. -The native GCN target is included with upstream LLVM, and has also been integrated with HCC compiler and can be used to compiler HIP programs for AMD. -Here's how to use it with HIP: - -- Follow the instructions here to compile the HCC and native LLVM compiler: -> https://github.com/RadeonOpenCompute/HCC-Native-GCN-ISA/wiki -> (In the make step for HCC, we recommend setting -DCMAKE_INSTALL_PREFIX=/opt/hcc-native) - -Set HCC_HOME environment variable before compiling HIP program to point to the native compiler: -```shell -export HCC_HOME=/opt/hcc-native -``` ## Examples and Getting Started: From 357491edd12a414bfbfaea0e11d33e962ac59e94 Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Mon, 2 May 2016 10:20:00 -0500 Subject: [PATCH 82/82] Add clang-hipify as optional make step --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7df6bed4db..13e6fb8485 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,14 @@ set(HIP_VERSION_MAJOR "0") set(HIP_VERSION_MINOR "84") set(HIP_VERSION_PATCH "0") -add_subdirectory(clang-hipify) + +if(NOT DEFINED BUILD_CLANG_HIPIFY) + set(BUILD_CLANG_HIPIFY 0) +endif() + +if(BUILD_CLANG_HIPIFY) + add_subdirectory(clang-hipify) +endif() ############################# # Configure variables @@ -18,9 +25,10 @@ if(NOT DEFINED HIP_PLATFORM) if(NOT DEFINED ENV{HIP_PLATFORM}) execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/hipconfig --platform OUTPUT_VARIABLE HIP_PLATFORM + OUTPUT_STRIP_TRAILING_WHITESPACE) else() set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE STRING "HIP Platform") - OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() endif() message(STATUS "HIP Platform: " ${HIP_PLATFORM})