Skip to content

Commit

Permalink
gpu:intel:sycl,ocl: properly propagate status from init_gpu_hw_info
Browse files Browse the repository at this point in the history
  • Loading branch information
mgouicem committed Dec 11, 2024
1 parent c654687 commit cc56329
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
19 changes: 7 additions & 12 deletions src/gpu/intel/ocl/ocl_gpu_hw_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ xpu::runtime_version_t get_driver_version(cl_device_id device) {
return runtime_version;
}

void init_gpu_hw_info(impl::engine_t *engine, cl_device_id device,
status_t init_gpu_hw_info(impl::engine_t *engine, cl_device_id device,
cl_context context, uint32_t &ip_version, compute::gpu_arch_t &gpu_arch,
int &gpu_product_family, int &stepping_id, uint64_t &native_extensions,
bool &mayiuse_systolic, bool &mayiuse_ngen_kernels) {
Expand All @@ -71,23 +71,18 @@ void init_gpu_hw_info(impl::engine_t *engine, cl_device_id device,
stepping_id = product.stepping;

mayiuse_systolic = false;
status_t ret
= get_ocl_device_enabled_systolic_intel(device, mayiuse_systolic);
assert(ret == CL_SUCCESS);
ret = get_ocl_device_enabled_native_float_atomics(
device, native_extensions, is_xelpg);
assert(ret == CL_SUCCESS);
MAYBE_UNUSED(ret);
CHECK(get_ocl_device_enabled_systolic_intel(device, mayiuse_systolic));
CHECK(get_ocl_device_enabled_native_float_atomics(
device, native_extensions, is_xelpg));

auto status
= jit::gpu_supports_binary_format(&mayiuse_ngen_kernels, engine);
if (status != status::success) mayiuse_ngen_kernels = false;

ip_version = 0;
if (clGetDeviceInfo(device, CL_DEVICE_IP_VERSION_INTEL, sizeof(ip_version),
&ip_version, nullptr)
!= CL_SUCCESS)
ip_version = 0;
OCL_CHECK(clGetDeviceInfo(device, CL_DEVICE_IP_VERSION_INTEL,
sizeof(ip_version), &ip_version, nullptr));
return status::success;
}

} // namespace ocl
Expand Down
2 changes: 1 addition & 1 deletion src/gpu/intel/ocl/ocl_gpu_hw_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace ocl {

xpu::runtime_version_t get_driver_version(cl_device_id device);

void init_gpu_hw_info(impl::engine_t *engine, cl_device_id device,
status_t init_gpu_hw_info(impl::engine_t *engine, cl_device_id device,
cl_context context, uint32_t &ip_version, compute::gpu_arch_t &gpu_arch,
int &gpu_product_family, int &stepping_id, uint64_t &native_extensions,
bool &mayiuse_systolic, bool &mayiuse_ngen_kernels);
Expand Down
8 changes: 5 additions & 3 deletions src/gpu/intel/sycl/device_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ status_t device_info_t::init_arch(impl::engine_t *engine) {
// skip other vendors
if (!xpu::sycl::is_intel_device(device)) return status::success;

auto status = status::success;
auto be = xpu::sycl::get_backend(device);
if (be == xpu::sycl::backend_t::opencl) {
auto ocl_dev = xpu::sycl::compat::get_native<cl_device_id>(device);
Expand All @@ -51,22 +52,23 @@ status_t device_info_t::init_arch(impl::engine_t *engine) {
auto ocl_ctx = xpu::sycl::compat::get_native<cl_context>(ctx);
auto ocl_ctx_wrapper = xpu::ocl::make_wrapper(ocl_ctx);

gpu::intel::ocl::init_gpu_hw_info(engine, ocl_dev_wrapper,
status = gpu::intel::ocl::init_gpu_hw_info(engine, ocl_dev_wrapper,
ocl_ctx_wrapper, ip_version_, gpu_arch_, gpu_product_family_,
stepping_id_, native_extensions_, mayiuse_systolic_,
mayiuse_ngen_kernels_);
} else if (be == xpu::sycl::backend_t::level0) {
auto ze_dev = xpu::sycl::compat::get_native<ze_device_handle_t>(device);
auto ze_ctx = xpu::sycl::compat::get_native<ze_context_handle_t>(ctx);

gpu::intel::sycl::init_gpu_hw_info(engine, ze_dev, ze_ctx, ip_version_,
status = gpu::intel::sycl::init_gpu_hw_info(engine, ze_dev, ze_ctx, ip_version_,
gpu_arch_, gpu_product_family_, stepping_id_,
native_extensions_, mayiuse_systolic_, mayiuse_ngen_kernels_);
} else {
assert(!"not_expected");
status = status::unimplemented;
}

return status::success;
return status;
}

status_t device_info_t::init_device_name(impl::engine_t *engine) {
Expand Down
10 changes: 4 additions & 6 deletions src/gpu/intel/sycl/l0/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ status_t get_l0_device_eu_count(ze_device_handle_t device, int &eu_count) {
return status::success;
}

void init_gpu_hw_info(impl::engine_t *engine, ze_device_handle_t device,
status_t init_gpu_hw_info(impl::engine_t *engine, ze_device_handle_t device,
ze_context_handle_t context, uint32_t &ip_version,
compute::gpu_arch_t &gpu_arch, int &gpu_product_family,
int &stepping_id, uint64_t &native_extensions, bool &mayiuse_systolic,
Expand All @@ -382,18 +382,16 @@ void init_gpu_hw_info(impl::engine_t *engine, ze_device_handle_t device,
stepping_id = product.stepping;

mayiuse_systolic = false;
status_t ret
= get_l0_device_enabled_systolic_intel(device, mayiuse_systolic);
CHECK(get_l0_device_enabled_systolic_intel(device, mayiuse_systolic));
// TODO: xelpg has no f64 support. check that the query properly handle that
ret = get_l0_device_enabled_native_float_atomics(device, native_extensions);
MAYBE_UNUSED(ret);
CHECK(get_l0_device_enabled_native_float_atomics(device, native_extensions));

auto status
= jit::gpu_supports_binary_format(&mayiuse_ngen_kernels, engine);
if (status != status::success) mayiuse_ngen_kernels = false;

ip_version = 0;
get_device_ip(device, ip_version);
return get_device_ip(device, ip_version);
}

} // namespace sycl
Expand Down
2 changes: 1 addition & 1 deletion src/gpu/intel/sycl/l0/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool compare_ze_devices(const ::sycl::device &lhs, const ::sycl::device &rhs);
status_t func_zeModuleGetNativeBinary(ze_module_handle_t hModule, size_t *pSize,
uint8_t *pModuleNativeBinary);

void init_gpu_hw_info(impl::engine_t *engine, ze_device_handle_t device,
status_t init_gpu_hw_info(impl::engine_t *engine, ze_device_handle_t device,
ze_context_handle_t context, uint32_t &ip_version,
compute::gpu_arch_t &gpu_arch, int &gpu_product_family,
int &stepping_id, uint64_t &native_extensions, bool &mayiuse_systolic,
Expand Down

0 comments on commit cc56329

Please sign in to comment.