@@ -761,7 +761,8 @@ class kernel_bundle_impl {
761
761
}
762
762
763
763
DeviceGlobalMapEntry *get_device_global_entry (const std::string &Name) {
764
- if (MLanguage != syclex::source_language::sycl_jit || MPrefix.empty ()) {
764
+ if (MKernelNames.empty () ||
765
+ MLanguage != syclex::source_language::sycl_jit) {
765
766
throw sycl::exception (make_error_code (errc::invalid),
766
767
" Querying device globals by name is only available "
767
768
" in kernel_bundles successfully built from "
@@ -806,7 +807,7 @@ class kernel_bundle_impl {
806
807
807
808
public:
808
809
bool ext_oneapi_has_kernel (const std::string &Name) {
809
- return is_kernel_name (adjust_kernel_name (Name));
810
+ return !MKernelNames. empty () && is_kernel_name (adjust_kernel_name (Name));
810
811
}
811
812
812
813
kernel
@@ -880,19 +881,21 @@ class kernel_bundle_impl {
880
881
}
881
882
882
883
bool ext_oneapi_has_device_global (const std::string &Name) {
883
- std::string MangledName = mangle_device_global_name (Name);
884
- return std::find (MDeviceGlobalNames.begin (), MDeviceGlobalNames.end (),
885
- MangledName) != MDeviceGlobalNames.end ();
884
+ return !MDeviceGlobalNames.empty () &&
885
+ std::find (MDeviceGlobalNames.begin (), MDeviceGlobalNames.end (),
886
+ mangle_device_global_name (Name)) !=
887
+ MDeviceGlobalNames.end ();
886
888
}
887
889
888
890
void *ext_oneapi_get_device_global_address (const std::string &Name,
889
891
const device &Dev) {
892
+ DeviceGlobalMapEntry *Entry = get_device_global_entry (Name);
893
+
890
894
if (std::find (MDevices.begin (), MDevices.end (), Dev) == MDevices.end ()) {
891
895
throw sycl::exception (make_error_code (errc::invalid),
892
896
" kernel_bundle not built for device" );
893
897
}
894
898
895
- DeviceGlobalMapEntry *Entry = get_device_global_entry (Name);
896
899
if (Entry->MIsDeviceImageScopeDecorated ) {
897
900
throw sycl::exception (make_error_code (errc::invalid),
898
901
" Cannot query USM pointer for device global with "
0 commit comments