Skip to content

Commit

Permalink
gpu: intel: sycl,ocl: properly propagate init_gpu_hw_info status
Browse files Browse the repository at this point in the history
  • Loading branch information
mgouicem committed Dec 19, 2024
1 parent 90f53dd commit 814e8bc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 25 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,13 +71,9 @@ 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);
Expand All @@ -88,10 +84,9 @@ void init_gpu_hw_info(impl::engine_t *engine, cl_device_id device,
}

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
10 changes: 6 additions & 4 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_,
gpu_arch_, gpu_product_family_, stepping_id_,
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
13 changes: 6 additions & 7 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,17 @@ 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);
// 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_systolic_intel(device, mayiuse_systolic));

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 814e8bc

Please sign in to comment.