Skip to content

Commit

Permalink
[HIPIFY][6.0.0][ROCm#1078][feature][partial] Support for ABI changes …
Browse files Browse the repository at this point in the history
…in documentation - Step 3

+ The known CUDA APIs, that were changed, were populated with the corresponding `Changed` version

[ToDo]
+ Introduce `C - Changed` column for CUDA API in the generated documentation
  • Loading branch information
emankov committed Oct 29, 2023
1 parent 46e3449 commit 4b1cdfa
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/CUDA2HIP.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ extern const std::map<llvm::StringRef, hipAPIversions> HIP_FFT_FUNCTION_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_TYPE_NAME_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIChangedVersions> HIP_SPARSE_FUNCTION_CHANGED_VER_MAP;
extern const std::map<llvm::StringRef, cudaAPIChangedVersions> CUDA_SPARSE_FUNCTION_CHANGED_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIversions> HIP_CAFFE2_TYPE_NAME_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIversions> HIP_CAFFE2_FUNCTION_VER_MAP;
extern const std::map<llvm::StringRef, hipAPIversions> HIP_DEVICE_TYPE_NAME_VER_MAP;
Expand Down
10 changes: 7 additions & 3 deletions src/CUDA2HIP_Doc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace doc {
typedef map<StringRef, cudaAPIversions> versionMap;
typedef map<StringRef, hipAPIversions> hipVersionMap;
typedef map<llvm::StringRef, hipAPIChangedVersions> hipChangedVersionMap;
typedef map<llvm::StringRef, cudaAPIChangedVersions> cudaChangedVersionMap;

const string sEmpty = "";
const string sMd = "md";
Expand Down Expand Up @@ -131,7 +132,8 @@ namespace doc {
const string sC = "C";
const string sR = "R";
const string sE = "E";
const hipChangedVersionMap mEmpty = {};
const hipChangedVersionMap hipChangedVersionMapEmpty = {};
const cudaChangedVersionMap cudaChangedVersionMapEmpty = {};

enum docType {
none = 0,
Expand Down Expand Up @@ -174,7 +176,8 @@ namespace doc {
virtual const typeMap &getTypes() const = 0;
virtual const versionMap &getFunctionVersions() const = 0;
virtual const hipVersionMap &getHipFunctionVersions() const = 0;
virtual const hipChangedVersionMap &getHipChangedFunctionVersions() const { return mEmpty; };
virtual const hipChangedVersionMap &getHipChangedFunctionVersions() const { return hipChangedVersionMapEmpty; };
virtual const cudaChangedVersionMap &getCudaChangedFunctionVersions() const { return cudaChangedVersionMapEmpty; };
virtual const versionMap &getTypeVersions() const = 0;
virtual const hipVersionMap &getHipTypeVersions() const = 0;
virtual const string &getAPI() const { return sHIP; }
Expand Down Expand Up @@ -663,7 +666,8 @@ namespace doc {
const typeMap &getTypes() const override { return CUDA_SPARSE_TYPE_NAME_MAP; }
const versionMap &getFunctionVersions() const override { return CUDA_SPARSE_FUNCTION_VER_MAP; }
const hipVersionMap &getHipFunctionVersions() const override { return HIP_SPARSE_FUNCTION_VER_MAP; }
const hipChangedVersionMap& getHipChangedFunctionVersions() const override { return HIP_SPARSE_FUNCTION_CHANGED_VER_MAP; }
const hipChangedVersionMap &getHipChangedFunctionVersions() const override { return HIP_SPARSE_FUNCTION_CHANGED_VER_MAP; }
const cudaChangedVersionMap &getCudaChangedFunctionVersions() const override { return CUDA_SPARSE_FUNCTION_CHANGED_VER_MAP; }
const versionMap &getTypeVersions() const override { return CUDA_SPARSE_TYPE_NAME_VER_MAP; }
const hipVersionMap &getHipTypeVersions() const override { return HIP_SPARSE_TYPE_NAME_VER_MAP; }
const string &getName() const override { return sCUSPARSE; }
Expand Down
45 changes: 45 additions & 0 deletions src/CUDA2HIP_SPARSE_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2275,6 +2275,51 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_SPARSE_FUNCTION_VER_MAP {
{"rocsparse_scsrgeam", {HIP_3050, HIP_0, HIP_0 }},
};

const std::map<llvm::StringRef, cudaAPIChangedVersions> CUDA_SPARSE_FUNCTION_CHANGED_VER_MAP {
{"cusparseSpVecGetIndexBase", {CUDA_120}},
{"cusparseDestroySpVec", {CUDA_120}},
{"cusparseDestroyDnVec", {CUDA_120}},
{"cusparseSpMatGetAttribute", {CUDA_120}},
{"cusparseSpMatGetFormat", {CUDA_120}},
{"cusparseSpMatGetSize", {CUDA_120}},
{"cusparseSpMatGetIndexBase", {CUDA_120}},
{"cusparseSpMatGetStridedBatch", {CUDA_120}},
{"cusparseDestroySpMat", {CUDA_120}},
{"cusparseSpGEMM_compute", {CUDA_120}},
{"cusparseSpGEMM_copy", {CUDA_120}},
{"cusparseSpGEMM_workEstimation", {CUDA_120}},
{"cusparseSpGEMMreuse_compute", {CUDA_120}},
{"cusparseSpGEMMreuse_copy", {CUDA_120}},
{"cusparseSpGEMMreuse_nnz", {CUDA_120}},
{"cusparseSpGEMMreuse_workEstimation", {CUDA_120}},
{"cusparseDnMatGetStridedBatch", {CUDA_120}},
{"cusparseDestroyDnMat", {CUDA_120}},
{"cusparseSpMM", {CUDA_120}},
{"cusparseSpMM_bufferSize", {CUDA_120}},
{"cusparseSpMM_preprocess", {CUDA_120}},
{"cusparseSpMV", {CUDA_120}},
{"cusparseSpMV_bufferSize", {CUDA_120}},
{"cusparseSpSM_analysis", {CUDA_120}},
{"cusparseSpSM_bufferSize", {CUDA_120}},
{"cusparseSpSM_solve", {CUDA_120}},
{"cusparseSpSV_analysis", {CUDA_120}},
{"cusparseSpSV_bufferSize", {CUDA_120}},
{"cusparseSpSV_solve", {CUDA_120}},
{"cusparseSpVV", {CUDA_120}},
{"cusparseSpVV_bufferSize", {CUDA_120}},
{"cusparseSDDMM", {CUDA_120}},
{"cusparseSDDMM_bufferSize", {CUDA_120}},
{"cusparseSDDMM_preprocess", {CUDA_120}},
{"cusparseAxpby", {CUDA_120}},
{"cusparseGather", {CUDA_120}},
{"cusparseScatter", {CUDA_120}},
{"cusparseSparseToDense", {CUDA_120}},
{"cusparseSparseToDense_bufferSize", {CUDA_120}},
{"cusparseDenseToSparse_analysis", {CUDA_120}},
{"cusparseDenseToSparse_bufferSize", {CUDA_120}},
{"cusparseDenseToSparse_convert", {CUDA_120}},
};

const std::map<llvm::StringRef, hipAPIChangedVersions> HIP_SPARSE_FUNCTION_CHANGED_VER_MAP {
{"hipsparseSpVecGetIndexBase", {HIP_6000}},
{"hipsparseDestroySpVec", {HIP_6000}},
Expand Down
1 change: 1 addition & 0 deletions src/Statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ struct hipAPIversions {
};

typedef std::list<hipVersions> hipAPIChangedVersions;
typedef std::list<cudaVersions> cudaAPIChangedVersions;

// The names of various fields in in the statistics reports.
extern const char *counterNames[NUM_CONV_TYPES];
Expand Down

0 comments on commit 4b1cdfa

Please sign in to comment.