Introducing hip::Device which wraps around amd::Context and deviceId

Change-Id: Ie35a6edb65c001b35eb9f5d2af26e765dc41c00e


[ROCm/hip commit: 9630e40beb]
This commit is contained in:
Christophe Paquot
2020-02-18 12:36:12 -08:00
committad av Christophe Paquot
förälder 6b7832ed27
incheckning 912bc9b38c
9 ändrade filer med 145 tillägg och 120 borttagningar
+2 -7
Visa fil
@@ -430,12 +430,7 @@ hipError_t hipDeviceSynchronize ( void ) {
}
int ihipGetDevice() {
for (unsigned int i = 0; i < g_devices.size(); i++) {
if (g_devices[i] == hip::getCurrentContext()) {
return i;
}
}
return -1;
return hip::getCurrentDevice()->deviceId();
}
hipError_t hipGetDevice ( int* deviceId ) {
@@ -483,7 +478,7 @@ hipError_t hipSetDevice ( int device ) {
HIP_INIT_API(hipSetDevice, device);
if (static_cast<unsigned int>(device) < g_devices.size()) {
hip::setCurrentContext(device);
hip::setCurrentDevice(device);
HIP_RETURN(hipSuccess);
}