Skip to content

Check if device support heterogeneous memory #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/acl_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ extern int platform_owner_tid;
void acl_init_platform(void);
void acl_finalize_init_platform(unsigned int num_devices,
const cl_device_id *devices);
const char *acl_platform_extensions(void);

#if defined(__cplusplus)
} /* extern "C" */
Expand Down
55 changes: 30 additions & 25 deletions src/acl_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,35 @@ int acl_platform_is_valid(cl_platform_id platform) {
return platform == &acl_platform;
}

const char *acl_platform_extensions() {
return "cl_khr_byte_addressable_store" // yes, we have correct access to
// individual bytes!
" cles_khr_int64" // yes, we support 64-bit ints in the embedded
// profile

" cl_khr_icd"
#if ACL_SUPPORT_IMAGES == 1
" cl_khr_3d_image_writes"
#endif
#if ACL_SUPPORT_DOUBLE == 1
" cl_khr_fp64"
#endif
#ifdef ACL_120
" cl_khr_global_int32_base_atomics"
" cl_khr_global_int32_extended_atomics"
" cl_khr_local_int32_base_atomics"
" cl_khr_local_int32_extended_atomics"
#endif
#ifndef __arm__
// Add the following once all USM APIs are implemented, Intel publishes
// the spec, and published USM conformance tests pass
//" cl_intel_unified_shared_memory"
#endif
" cl_intel_create_buffer_with_properties"
" cl_intel_mem_channel_property"
" cl_intel_mem_alloc_buffer_location";
}

// Initialize the internal bookkeeping based on the system definition
// provided to us.
void acl_init_platform(void) {
Expand Down Expand Up @@ -298,31 +327,7 @@ void acl_init_platform(void) {
// The extensions string specifies the extensions supported by our framework.
// To add an extension, append a flag name and separate it from others using a
// space.
acl_platform.extensions =
"cl_khr_byte_addressable_store" // yes, we have correct access to
// individual bytes!
" cles_khr_int64" // yes, we support 64-bit ints in the embedded profile

" cl_khr_icd"
#if ACL_SUPPORT_IMAGES == 1
" cl_khr_3d_image_writes"
#endif
#if ACL_SUPPORT_DOUBLE == 1
" cl_khr_fp64"
#endif
#ifdef ACL_120
" cl_khr_global_int32_base_atomics"
" cl_khr_global_int32_extended_atomics"
" cl_khr_local_int32_base_atomics"
" cl_khr_local_int32_extended_atomics"
#endif
#ifndef __arm__
// Add the following once all USM APIs are implemented, Intel publishes
// the spec, and published USM conformance tests pass
//" cl_intel_unified_shared_memory"
#endif
" cl_intel_create_buffer_with_properties"
" cl_intel_mem_channel_property";
acl_platform.extensions = acl_platform_extensions();

acl_platform.profile = "EMBEDDED_PROFILE";
acl_platform.hal = acl_get_hal();
Expand Down
8 changes: 5 additions & 3 deletions test/acl_device_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <acl.h>
#include <acl_context.h>
#include <acl_platform.h>
#include <acl_types.h>
#include <acl_util.h>

Expand Down Expand Up @@ -324,9 +325,10 @@ MT_TEST(DeviceInfo, basic) {
CHECK_EQUAL(CL_SUCCESS, clGetDeviceInfo(device, queries[i], str_size,
&str[0], &size_ret));

if (queries[i] != CL_DEVICE_EXTENSIONS) {
// Non-empty result for most supported queries.
CHECK(size_ret > 0);
CHECK(size_ret > 0);

if (queries[i] == CL_DEVICE_EXTENSIONS) {
CHECK(strcmp(str, acl_platform_extensions()) == 0);
}

switch (queries[i]) {
Expand Down