@@ -40,25 +40,6 @@ void ConcreteAPI::setDevice(int deviceId) {
4040 hipFree (nullptr );
4141 CHECK_ERR;
4242
43- hipDeviceProp_t properties{};
44- hipGetDeviceProperties (&properties, deviceId);
45- CHECK_ERR;
46-
47- // NOTE: hipDeviceGetAttribute internally calls hipGetDeviceProperties; hence it doesn't make sense to use it here
48-
49- if constexpr (HIP_VERSION >= 60200000 ) {
50- // cf. https://rocm.docs.amd.com/en/docs-6.2.0/about/release-notes.html
51- // (before 6.2.0, the flag hipDeviceAttributePageableMemoryAccessUsesHostPageTables had effectively the same effect)
52- // (cf. https://github.com/ROCm/clr/commit/7d5b4a8f7a7d34f008d65277f8aae4c98a6da375#diff-596cd550f7fdef76b39f1b7b179b20128313dd9cc9ec662b2eae562efa2b7f33L405 )
53- usmDefault = properties.integrated != 0 ;
54- }
55- else {
56- usmDefault = properties.directManagedMemAccessFromHost != 0 && properties.pageableMemoryAccessUsesHostPageTables != 0 ;
57- }
58-
59- hipDeviceGetStreamPriorityRange (&priorityMin, &priorityMax);
60- CHECK_ERR;
61-
6243 status[StatusID::DeviceSelected] = true ;
6344}
6445
@@ -74,6 +55,25 @@ void ConcreteAPI::initialize() {
7455 if (!status[StatusID::InterfaceInitialized]) {
7556 status[StatusID::InterfaceInitialized] = true ;
7657 hipStreamCreateWithFlags (&defaultStream, hipStreamNonBlocking); CHECK_ERR;
58+
59+ hipDeviceProp_t properties{};
60+ hipGetDeviceProperties (&properties, deviceId);
61+ CHECK_ERR;
62+
63+ // NOTE: hipDeviceGetAttribute internally calls hipGetDeviceProperties; hence it doesn't make sense to use it here
64+
65+ if constexpr (HIP_VERSION >= 60200000 ) {
66+ // cf. https://rocm.docs.amd.com/en/docs-6.2.0/about/release-notes.html
67+ // (before 6.2.0, the flag hipDeviceAttributePageableMemoryAccessUsesHostPageTables had effectively the same effect)
68+ // (cf. https://github.com/ROCm/clr/commit/7d5b4a8f7a7d34f008d65277f8aae4c98a6da375#diff-596cd550f7fdef76b39f1b7b179b20128313dd9cc9ec662b2eae562efa2b7f33L405 )
69+ usmDefault = properties.integrated != 0 ;
70+ }
71+ else {
72+ usmDefault = properties.directManagedMemAccessFromHost != 0 && properties.pageableMemoryAccessUsesHostPageTables != 0 ;
73+ }
74+
75+ hipDeviceGetStreamPriorityRange (&priorityMin, &priorityMax);
76+ CHECK_ERR;
7777 }
7878 else {
7979 logWarning () << " Device Interface has already been initialized" ;
0 commit comments