2929
3030namespace alpaka
3131{
32+
33+ template <typename TApi>
34+ class DevUniformCudaHipRt ;
35+
3236 namespace trait
3337 {
3438 template <typename TPlatform, typename TSfinae>
@@ -38,13 +42,16 @@ namespace alpaka
3842 namespace detail
3943 {
4044 template <typename TApi>
41- inline void setDeviceProperties (int iDevice, alpaka::DeviceProperties& devProperties)
45+ inline void setDeviceProperties (
46+ DevUniformCudaHipRt<TApi> const & device,
47+ alpaka::DeviceProperties& devProperties)
4248 {
4349 // There is cuda/hip-DeviceGetAttribute as faster alternative to
4450 // cuda/hip-GetDeviceProperties to get a single device property but it has no option to get
4551 // the name
52+ auto devHandle = device.getNativeHandle ();
4653 typename TApi::DeviceProp_t devProp;
47- ALPAKA_UNIFORM_CUDA_HIP_RT_CHECK (TApi::getDeviceProperties (&devProp, iDevice ));
54+ ALPAKA_UNIFORM_CUDA_HIP_RT_CHECK (TApi::getDeviceProperties (&devProp, devHandle ));
4855 devProperties.name = std::string (devProp.name );
4956
5057 std::size_t freeInternal (0u );
@@ -54,7 +61,7 @@ namespace alpaka
5461
5562 int warpSize = 0 ;
5663 ALPAKA_UNIFORM_CUDA_HIP_RT_CHECK (
57- TApi::deviceGetAttribute (&warpSize, TApi::deviceAttributeWarpSize, iDevice ));
64+ TApi::deviceGetAttribute (&warpSize, TApi::deviceAttributeWarpSize, devHandle ));
5865 devProperties.warpSizes = std::vector<std::size_t >{static_cast <std::size_t >(warpSize)};
5966 devProperties.preferredWarpSize = static_cast <std::size_t >(warpSize);
6067 }
@@ -148,7 +155,7 @@ namespace alpaka
148155 {
149156 ALPAKA_FN_HOST static auto getName (DevUniformCudaHipRt<TApi> const & dev) -> std::string
150157 {
151- return dev.m_QueueRegistry ->template deviceProperties <TApi> (dev. getNativeHandle () )->name ;
158+ return dev.m_QueueRegistry ->deviceProperties (dev)->name ;
152159 }
153160 };
154161
@@ -158,7 +165,7 @@ namespace alpaka
158165 {
159166 ALPAKA_FN_HOST static auto getMemBytes (DevUniformCudaHipRt<TApi> const & dev) -> std::size_t
160167 {
161- return dev.m_QueueRegistry ->template deviceProperties <TApi> (dev. getNativeHandle () )->totalGlobalMem ;
168+ return dev.m_QueueRegistry ->deviceProperties (dev)->totalGlobalMem ;
162169 }
163170 };
164171
@@ -183,7 +190,7 @@ namespace alpaka
183190 {
184191 ALPAKA_FN_HOST static auto getWarpSizes (DevUniformCudaHipRt<TApi> const & dev) -> std::vector<std::size_t>
185192 {
186- return dev.m_QueueRegistry ->template deviceProperties <TApi> (dev. getNativeHandle () )->warpSizes ;
193+ return dev.m_QueueRegistry ->deviceProperties (dev)->warpSizes ;
187194 }
188195 };
189196
@@ -193,7 +200,7 @@ namespace alpaka
193200 {
194201 ALPAKA_FN_HOST static auto getPreferredWarpSize (DevUniformCudaHipRt<TApi> const & dev) -> std::size_t
195202 {
196- return dev.m_QueueRegistry ->template deviceProperties <TApi> (dev. getNativeHandle () )->preferredWarpSize ;
203+ return dev.m_QueueRegistry ->deviceProperties (dev)->preferredWarpSize ;
197204 }
198205 };
199206
0 commit comments