[llvm] [OFFLOAD] Replace C-style casts with C++ style casts in obtainInfoImpl (PR #185023)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 6 07:20:18 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-offload
Author: Ćukasz Plewa (lplewa)
<details>
<summary>Changes</summary>
Replace C-style bool casts (bool)TmpInt with C++ functional casts bool(TmpInt)
---
Full diff: https://github.com/llvm/llvm-project/pull/185023.diff
1 Files Affected:
- (modified) offload/plugins-nextgen/cuda/src/rtl.cpp (+12-12)
``````````diff
diff --git a/offload/plugins-nextgen/cuda/src/rtl.cpp b/offload/plugins-nextgen/cuda/src/rtl.cpp
index d5ab0b3309c86..c50c70a4456fa 100644
--- a/offload/plugins-nextgen/cuda/src/rtl.cpp
+++ b/offload/plugins-nextgen/cuda/src/rtl.cpp
@@ -1119,7 +1119,7 @@ struct CUDADeviceTy : public GenericDeviceTy {
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_GPU_OVERLAP, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Concurrent Copy and Execution", (bool)TmpInt);
+ Info.add("Concurrent Copy and Execution", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, TmpInt);
if (Res == CUDA_SUCCESS)
@@ -1185,15 +1185,15 @@ struct CUDADeviceTy : public GenericDeviceTy {
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Execution Timeout", (bool)TmpInt);
+ Info.add("Execution Timeout", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_INTEGRATED, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Integrated Device", (bool)TmpInt);
+ Info.add("Integrated Device", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Can Map Host Memory", (bool)TmpInt);
+ Info.add("Can Map Host Memory", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_COMPUTE_MODE, TmpInt);
if (Res == CUDA_SUCCESS) {
@@ -1210,11 +1210,11 @@ struct CUDADeviceTy : public GenericDeviceTy {
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Concurrent Kernels", (bool)TmpInt);
+ Info.add("Concurrent Kernels", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_ECC_ENABLED, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("ECC Enabled", (bool)TmpInt);
+ Info.add("ECC Enabled", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE, TmpInt);
if (Res == CUDA_SUCCESS)
@@ -1240,29 +1240,29 @@ struct CUDADeviceTy : public GenericDeviceTy {
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Unified Addressing", (bool)TmpInt);
+ Info.add("Unified Addressing", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Managed Memory", (bool)TmpInt);
+ Info.add("Managed Memory", bool(TmpInt));
Res =
getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Concurrent Managed Memory", (bool)TmpInt);
+ Info.add("Concurrent Managed Memory", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_COMPUTE_PREEMPTION_SUPPORTED,
TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Preemption Supported", (bool)TmpInt);
+ Info.add("Preemption Supported", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_COOPERATIVE_LAUNCH, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Cooperative Launch", (bool)TmpInt);
+ Info.add("Cooperative Launch", bool(TmpInt));
Res = getDeviceAttrRaw(CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD, TmpInt);
if (Res == CUDA_SUCCESS)
- Info.add("Multi-Device Boars", (bool)TmpInt);
+ Info.add("Multi-Device Boars", bool(TmpInt));
Info.add("Compute Capabilities", ComputeCapability.str());
``````````
</details>
https://github.com/llvm/llvm-project/pull/185023
More information about the llvm-commits
mailing list