From b19d349daa3d6eda95b69cdd73802268b0ea0787 Mon Sep 17 00:00:00 2001 From: foreman Date: Mon, 8 Apr 2019 15:23:35 -0400 Subject: [PATCH] P4 to Git Change 1766904 by michliao@hliao-dev-00-hip.rocm-workspace on 2019/04/08 14:42:29 SWDEV-145570 - Check host_context when matching GPU device. - In CL#1766264, `host_context` is introduced for mGPU support. Need to match that context specially when trying to match GPU device context. The following tests passed: $ python test_dataloader.py TestDictDataLoader.test_pin_memory . ---------------------------------------------------------------------- Ran 1 test in 0.004s OK $ python test_dataloader.py TestDataLoader.test_sequential_pin_memory . ---------------------------------------------------------------------- Ran 1 test in 0.063s OK $ python test_dataloader.py TestDataLoader.test_shuffle_pin_memory . ---------------------------------------------------------------------- Ran 1 test in 0.174s OK $ python test_dataloader.py TestStringDataLoader.test_shuffle_pin_memory . ---------------------------------------------------------------------- Ran 1 test in 0.104s OK $ python test_torch.py TestTorch.test_pin_memory . ---------------------------------------------------------------------- Ran 1 test in 0.124s OK Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#52 edit [ROCm/clr commit: 9b36b245c969e945f71a662265f3277ae5d5c249] --- projects/clr/hipamd/api/hip/hip_memory.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/clr/hipamd/api/hip/hip_memory.cpp b/projects/clr/hipamd/api/hip/hip_memory.cpp index 9dfa4d4ddd..ab33573d72 100644 --- a/projects/clr/hipamd/api/hip/hip_memory.cpp +++ b/projects/clr/hipamd/api/hip/hip_memory.cpp @@ -1456,6 +1456,8 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void attributes->allocationFlags = memObj->getMemFlags() >> 16; amd::Context &memObjCtx = memObj->getContext(); + if (*hip::host_context == memObjCtx) + HIP_RETURN(hipSuccess); for (auto& ctx : g_devices) { if (*ctx == memObjCtx) { attributes->device = device;