diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 42189e6c9b..4e70c39ca5 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -151,6 +151,7 @@ jobs: run: | # echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd export OCL_ICD_FILENAMES=libintelocl.so + export SYCL_ENABLE_HOST_DEVICE=1 # clinfo -l python -m pytest --pyargs $MODULE_NAME @@ -208,7 +209,9 @@ jobs: - name: Add library run: echo "OCL_ICD_FILENAMES=C:\Miniconda\Library\lib\intelocl64.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Run tests - run: python -m pytest --pyargs ${{ env.MODULE_NAME }} + run: | + set SYCL_ENABLE_HOST_DEVICE=1 + python -m pytest --pyargs ${{ env.MODULE_NAME }} upload_linux: needs: test_linux diff --git a/dpctl-capi/source/dpctl_sycl_device_manager.cpp b/dpctl-capi/source/dpctl_sycl_device_manager.cpp index 713d9e29ac..67446d6350 100644 --- a/dpctl-capi/source/dpctl_sycl_device_manager.cpp +++ b/dpctl-capi/source/dpctl_sycl_device_manager.cpp @@ -124,7 +124,15 @@ struct DeviceCacheBuilder for (const auto &D : Devices) { if (mRanker(D) < 0) continue; - auto entry = cache_l.emplace(D, D); + + // Per https://github.com/intel/llvm/blob/sycl/sycl/doc/ + // extensions/PlatformContext/PlatformContext.adoc + // sycl::queue(D) would create default platform context + // for capable compiler, sycl::context(D) otherwise + auto Q = queue(D); + auto Ctx = Q.get_context(); + auto entry = cache_l.emplace(D, Ctx); + if (!entry.second) { std::cerr << "Fatal Error during device cache " "construction.\n"; diff --git a/dpctl/tests/test_sycl_usm.py b/dpctl/tests/test_sycl_usm.py index 036fc7e391..da19c37668 100644 --- a/dpctl/tests/test_sycl_usm.py +++ b/dpctl/tests/test_sycl_usm.py @@ -201,7 +201,7 @@ def test_pickling_reconstructor_invalid_type(memory_ctor): mobj = memory_ctor(1024, alignment=64) good_pickle_bytes = pickle.dumps(mobj) usm_types = expected_usm_type(memory_ctor).encode("utf-8") - i = good_pickle_bytes.index(usm_types) + i = good_pickle_bytes.rfind(usm_types) bad_pickle_bytes = good_pickle_bytes[:i] + b"u" + good_pickle_bytes[i + 1 :] with pytest.raises(ValueError): pickle.loads(bad_pickle_bytes)