Skip to content

Commit

Permalink
Merge pull request #1822 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][RT][6.4.0] Sync with `HIP LRT 6.4.0` - `hipDeviceGetTexture1DLinearMaxWidth` - incomplete
  • Loading branch information
emankov authored Jan 9, 2025
2 parents 57b2b41 + 1066819 commit 0016c25
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
4 changes: 4 additions & 0 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -1403,13 +1403,15 @@ my %experimental_funcs = (
"cudaEventRecordWithFlags" => "6.4.0",
"cudaErrorInvalidTexture" => "6.4.0",
"cudaErrorInvalidChannelDescriptor" => "6.4.0",
"cudaDeviceGetTexture1DLinearMaxWidth" => "6.4.0",
"cuStreamBatchMemOp_v2" => "6.4.0",
"cuStreamBatchMemOp" => "6.4.0",
"cuGraphExecBatchMemOpNodeSetParams" => "6.4.0",
"cuGraphBatchMemOpNodeSetParams" => "6.4.0",
"cuGraphBatchMemOpNodeGetParams" => "6.4.0",
"cuGraphAddBatchMemOpNode" => "6.4.0",
"cuEventRecordWithFlags" => "6.4.0",
"cuDeviceGetTexture1DLinearMaxWidth" => "6.4.0",
"CUstreamBatchMemOpType_enum" => "6.4.0",
"CUstreamBatchMemOpType" => "6.4.0",
"CUstreamBatchMemOpParams_v1" => "6.4.0",
Expand Down Expand Up @@ -1565,6 +1567,8 @@ sub subst {
}

sub experimentalSubstitutions {
subst("cuDeviceGetTexture1DLinearMaxWidth", "hipDeviceGetTexture1DLinearMaxWidth", "device");
subst("cudaDeviceGetTexture1DLinearMaxWidth", "hipDeviceGetTexture1DLinearMaxWidth", "device");
subst("cuEventRecordWithFlags", "hipEventRecordWithFlags", "event");
subst("cudaEventRecordWithFlags", "hipEventRecordWithFlags", "event");
subst("cuStreamBatchMemOp", "hipStreamBatchMemOp", "stream_memory");
Expand Down
2 changes: 1 addition & 1 deletion docs/tables/CUDA_Driver_API_functions_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@
|`cuDeviceGetMemPool`|11.2| | | |`hipDeviceGetMemPool`|5.2.0| | | | |
|`cuDeviceGetName`| | | | |`hipDeviceGetName`|1.6.0| | | | |
|`cuDeviceGetNvSciSyncAttributes`|10.2| | | | | | | | | |
|`cuDeviceGetTexture1DLinearMaxWidth`|11.1| | | | | | | | | |
|`cuDeviceGetTexture1DLinearMaxWidth`|11.1| | | |`hipDeviceGetTexture1DLinearMaxWidth`|6.4.0| | | |6.4.0|
|`cuDeviceGetUuid`|9.2| | | |`hipDeviceGetUuid`|5.2.0| | | | |
|`cuDeviceGetUuid_v2`|11.4| | | |`hipDeviceGetUuid`|5.2.0| | | | |
|`cuDeviceSetMemPool`|11.2| | | |`hipDeviceSetMemPool`|5.2.0| | | | |
Expand Down
2 changes: 1 addition & 1 deletion docs/tables/CUDA_Runtime_API_functions_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
|`cudaDeviceGetP2PAttribute`|8.0| | | |`hipDeviceGetP2PAttribute`|3.8.0| | | | |
|`cudaDeviceGetPCIBusId`| | | | |`hipDeviceGetPCIBusId`|1.6.0| | | | |
|`cudaDeviceGetStreamPriorityRange`| | | | |`hipDeviceGetStreamPriorityRange`|2.0.0| | | | |
|`cudaDeviceGetTexture1DLinearMaxWidth`|11.1| | | | | | | | | |
|`cudaDeviceGetTexture1DLinearMaxWidth`|11.1| | | |`hipDeviceGetTexture1DLinearMaxWidth`|6.4.0| | | |6.4.0|
|`cudaDeviceReset`| | | | |`hipDeviceReset`|1.6.0| | | | |
|`cudaDeviceSetCacheConfig`| | | | |`hipDeviceSetCacheConfig`|1.6.0| | | | |
|`cudaDeviceSetLimit`| | | | |`hipDeviceSetLimit`|5.3.0| | | | |
Expand Down
5 changes: 3 additions & 2 deletions src/CUDA2HIP_Driver_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_FUNCTION_MAP {
// no analogue
{"cuDeviceTotalMem", {"hipDeviceTotalMem", "", CONV_DEVICE, API_DRIVER, SEC::DEVICE}},
{"cuDeviceTotalMem_v2", {"hipDeviceTotalMem", "", CONV_DEVICE, API_DRIVER, SEC::DEVICE}},
// cudaDeviceGetTexture1DLinearMaxWidth
{"cuDeviceGetTexture1DLinearMaxWidth", {"hipDeviceGetTexture1DLinearMaxWidth", "", CONV_DEVICE, API_DRIVER, SEC::DEVICE, HIP_UNSUPPORTED}},
// NOTE: incompatible with cudaDeviceGetTexture1DLinearMaxWidth
{"cuDeviceGetTexture1DLinearMaxWidth", {"hipDeviceGetTexture1DLinearMaxWidth", "", CONV_DEVICE, API_DRIVER, SEC::DEVICE, HIP_EXPERIMENTAL}},
// cudaDeviceSetMemPool
{"cuDeviceSetMemPool", {"hipDeviceSetMemPool", "", CONV_DEVICE, API_DRIVER, SEC::DEVICE}},
// cudaDeviceGetMemPool
Expand Down Expand Up @@ -1671,6 +1671,7 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_DRIVER_FUNCTION_VER_MAP {
{"hipGraphBatchMemOpNodeSetParams", {HIP_6040, HIP_0, HIP_0, HIP_LATEST}},
{"hipGraphExecBatchMemOpNodeSetParams", {HIP_6040, HIP_0, HIP_0, HIP_LATEST}},
{"hipEventRecordWithFlags", {HIP_6040, HIP_0, HIP_0, HIP_LATEST}},
{"hipDeviceGetTexture1DLinearMaxWidth", {HIP_6040, HIP_0, HIP_0, HIP_LATEST}},
};

const std::map<llvm::StringRef, cudaAPIChangedVersions> CUDA_DRIVER_FUNCTION_CHANGED_VER_MAP {
Expand Down
4 changes: 2 additions & 2 deletions src/CUDA2HIP_Runtime_API_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_FUNCTION_MAP {
{"cudaSetDeviceFlags", {"hipSetDeviceFlags", "", CONV_DEVICE, API_RUNTIME, SEC::DEVICE}},
// no analogue
{"cudaSetValidDevices", {"hipSetValidDevices", "", CONV_DEVICE, API_RUNTIME, SEC::DEVICE}},
// cuDeviceGetTexture1DLinearMaxWidth
{"cudaDeviceGetTexture1DLinearMaxWidth", {"hipDeviceGetTexture1DLinearMaxWidth", "", CONV_DEVICE, API_RUNTIME, SEC::DEVICE, HIP_UNSUPPORTED}},
// NOTE: incompatible with cuDeviceGetTexture1DLinearMaxWidth
{"cudaDeviceGetTexture1DLinearMaxWidth", {"hipDeviceGetTexture1DLinearMaxWidth", "", CONV_DEVICE, API_RUNTIME, SEC::DEVICE, HIP_EXPERIMENTAL}},
// cuDeviceGetDefaultMemPool
{"cudaDeviceGetDefaultMemPool", {"hipDeviceGetDefaultMemPool", "", CONV_DEVICE, API_RUNTIME, SEC::DEVICE}},
// cuDeviceSetMemPool
Expand Down
5 changes: 5 additions & 0 deletions tests/unit_tests/synthetic/driver_functions.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,11 @@ int main() {
// HIP: hipError_t hipEventRecordWithFlags(hipEvent_t event, hipStream_t stream __dparm(0), unsigned int flags __dparm(0));
// CHECK: result = hipEventRecordWithFlags(event_, stream, flags);
result = cuEventRecordWithFlags(event_, stream, flags);

// TODO [LRT]: make hipDeviceGetTexture1DLinearMaxWidth (better hipDrvDeviceGetTexture1DLinearMaxWidth) compatible with cuDeviceGetTexture1DLinearMaxWidth
// CUDA:CUresult CUDAAPI cuDeviceGetTexture1DLinearMaxWidth(size_t *maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice dev);
// HIP: hipError_t hipDeviceGetTexture1DLinearMaxWidth(hipMemPool_t* mem_pool, int device);
result = cuDeviceGetTexture1DLinearMaxWidth(&bytes, array_format, flags, device);
#endif

#if CUDA_VERSION >= 11020
Expand Down
5 changes: 5 additions & 0 deletions tests/unit_tests/synthetic/runtime_functions.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,11 @@ int main() {
// HIP: hipError_t hipEventRecordWithFlags(hipEvent_t event, hipStream_t stream __dparm(0), unsigned int flags __dparm(0));
// CHECK: result = hipEventRecordWithFlags(Event_t, stream, flags);
result = cudaEventRecordWithFlags(Event_t, stream, flags);

// TODO [LRT]: make hipDeviceGetTexture1DLinearMaxWidth compatible with cudaDeviceGetTexture1DLinearMaxWidth
// CUDA:extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetTexture1DLinearMaxWidth(size_t *maxWidthInElements, const struct cudaChannelFormatDesc *fmtDesc, int device);
// HIP: hipError_t hipDeviceGetTexture1DLinearMaxWidth(hipMemPool_t* mem_pool, int device);
result = cudaDeviceGetTexture1DLinearMaxWidth(&bytes, &ChannelFormatDesc, device);
#endif

#if CUDA_VERSION >= 11020
Expand Down

0 comments on commit 0016c25

Please sign in to comment.