diff --git a/sycl/include/sycl/backend_types.hpp b/sycl/include/sycl/backend_types.hpp index c0a274febc9e7..143ec9877aabb 100644 --- a/sycl/include/sycl/backend_types.hpp +++ b/sycl/include/sycl/backend_types.hpp @@ -25,6 +25,7 @@ enum class backend : char { // ext_intel_esimd_emulator = 5, ext_oneapi_hip = 6, ext_oneapi_native_cpu = 7, + ext_oneapi_offload = 8, }; template class backend_traits; @@ -56,6 +57,9 @@ inline std::ostream &operator<<(std::ostream &Out, backend be) { case backend::ext_oneapi_native_cpu: Out << "ext_oneapi_native_cpu"; break; + case backend::ext_oneapi_offload: + Out << "ext_oneapi_offload"; + break; case backend::all: Out << "all"; } @@ -77,6 +81,8 @@ inline std::string_view get_backend_name_no_vendor(backend Backend) { return "hip"; case backend::ext_oneapi_native_cpu: return "native_cpu"; + case backend::ext_oneapi_offload: + return "offload"; case backend::all: return "all"; } diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index 9ce7acec912c5..7ac8d3bc00f6a 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -62,6 +62,8 @@ backend convertUrBackend(ur_backend_t UrBackend) { return backend::ext_oneapi_hip; case UR_BACKEND_NATIVE_CPU: return backend::ext_oneapi_native_cpu; + case UR_BACKEND_OFFLOAD: + return backend::ext_oneapi_offload; default: throw exception(make_error_code(errc::runtime), "convertBackend: Unsupported backend"); diff --git a/sycl/source/detail/config.cpp b/sycl/source/detail/config.cpp index 40d1e82ad7a34..63e20207962f9 100644 --- a/sycl/source/detail/config.cpp +++ b/sycl/source/detail/config.cpp @@ -166,14 +166,17 @@ void dumpConfig() { // ONEAPI_DEVICE_SELECTOR // TODO: host device type will be removed once sycl_ext_oneapi_filter_selector // is removed. -const std::array, 7> &getSyclBeMap() { - static const std::array, 7> SyclBeMap = { +const std::array, 8> &getSyclBeMap() { + static const std::array, 8> SyclBeMap = { {{"host", backend::host}, {"opencl", backend::opencl}, {"level_zero", backend::ext_oneapi_level_zero}, {"cuda", backend::ext_oneapi_cuda}, {"hip", backend::ext_oneapi_hip}, {"native_cpu", backend::ext_oneapi_native_cpu}, + // Note: Offload is intentionally excluded from our documentation - it's + // only used for internal testing + {"offload", backend::ext_oneapi_offload}, {"*", backend::all}}}; return SyclBeMap; } diff --git a/sycl/source/detail/config.hpp b/sycl/source/detail/config.hpp index ba1005f2fc1f2..d08d42a238d99 100644 --- a/sycl/source/detail/config.hpp +++ b/sycl/source/detail/config.hpp @@ -251,7 +251,7 @@ getSyclDeviceTypeMap() { // Array is used by SYCL_DEVICE_FILTER and SYCL_DEVICE_ALLOWLIST and // ONEAPI_DEVICE_SELECTOR -const std::array, 7> &getSyclBeMap(); +const std::array, 8> &getSyclBeMap(); // --------------------------------------- // ONEAPI_DEVICE_SELECTOR support diff --git a/sycl/source/detail/ur.cpp b/sycl/source/detail/ur.cpp index 525d8ab1d6a09..115edcf706c73 100644 --- a/sycl/source/detail/ur.cpp +++ b/sycl/source/detail/ur.cpp @@ -217,6 +217,8 @@ static void initializeAdapters(std::vector &Adapters, return backend::ext_oneapi_hip; case UR_BACKEND_NATIVE_CPU: return backend::ext_oneapi_native_cpu; + case UR_BACKEND_OFFLOAD: + return backend::ext_oneapi_offload; default: // Throw an exception, this should be unreachable. CHECK_UR_SUCCESS(UR_RESULT_ERROR_INVALID_ENUMERATION) diff --git a/sycl/test-e2e/Basic/get_backend.cpp b/sycl/test-e2e/Basic/get_backend.cpp index 374bcc0fba8f7..2275ffa7e7a3c 100644 --- a/sycl/test-e2e/Basic/get_backend.cpp +++ b/sycl/test-e2e/Basic/get_backend.cpp @@ -22,6 +22,7 @@ bool check(backend be) { case backend::ext_oneapi_cuda: case backend::ext_oneapi_hip: case backend::ext_oneapi_native_cpu: + case backend::ext_oneapi_offload: return true; default: return false; diff --git a/sycl/test-e2e/Regression/device_num.cpp b/sycl/test-e2e/Regression/device_num.cpp index db8706d925d76..6479c906041d5 100644 --- a/sycl/test-e2e/Regression/device_num.cpp +++ b/sycl/test-e2e/Regression/device_num.cpp @@ -28,7 +28,8 @@ const std::map BackendStringMap = { {backend::ext_oneapi_level_zero, "ext_oneapi_level_zero"}, {backend::ext_oneapi_cuda, "ext_oneapi_cuda"}, {backend::ext_oneapi_hip, "ext_oneapi_hip"}, - {backend::ext_oneapi_native_cpu, "ext_oneapi_native_cpu"}}; + {backend::ext_oneapi_native_cpu, "ext_oneapi_native_cpu"}, + {backend::ext_oneapi_offload, "ext_oneapi_offload"}}; std::string getDeviceTypeName(const device &d) { auto DeviceType = d.get_info(); diff --git a/sycl/unittests/allowlist/ParseAllowList.cpp b/sycl/unittests/allowlist/ParseAllowList.cpp index 2216674f244ea..d2b73d909e093 100644 --- a/sycl/unittests/allowlist/ParseAllowList.cpp +++ b/sycl/unittests/allowlist/ParseAllowList.cpp @@ -170,7 +170,7 @@ TEST(ParseAllowListTests, CheckAllValidBackendNameValuesAreProcessed) { {{"BackendName", "host"}}, {{"BackendName", "opencl"}}, {{"BackendName", "level_zero"}}, {{"BackendName", "cuda"}}, {{"BackendName", "hip"}}, {{"BackendName", "native_cpu"}}, - {{"BackendName", "*"}}}; + {{"BackendName", "offload"}}, {{"BackendName", "*"}}}; EXPECT_EQ(ExpectedValue, ActualValue); } diff --git a/sycl/unittests/helpers/UrMock.hpp b/sycl/unittests/helpers/UrMock.hpp index 934dd9f5f7a84..9f5ece694599d 100644 --- a/sycl/unittests/helpers/UrMock.hpp +++ b/sycl/unittests/helpers/UrMock.hpp @@ -633,6 +633,8 @@ template class UrMock { return UR_BACKEND_HIP; case sycl::backend::ext_oneapi_native_cpu: return UR_BACKEND_NATIVE_CPU; + case sycl::backend::ext_oneapi_offload: + return UR_BACKEND_OFFLOAD; default: return UR_BACKEND_UNKNOWN; }