dpctl icon indicating copy to clipboard operation
dpctl copied to clipboard

DPC++ does not support all aspects from SYCL 2020

Open 1e-to opened this issue 5 years ago • 3 comments

The list of aspects that don't supported in actual way.

  • emulated
  • host_debuggable
  • atomic64
  • usm_atomic_host_allocations
  • usm_atomic_shared_allocations
  • usm_system_allocations

1e-to avatar Mar 04 '21 16:03 1e-to

The following C++ code

#include <CL/sycl.hpp>
#include <iostream>

int main(void) {
    sycl::device d {};

    sycl::vector_class<sycl::aspect> asps = {
        sycl::aspect::emulated,
        sycl::aspect::host_debuggable,
        sycl::aspect::atomic64,
        sycl::aspect::usm_atomic_host_allocations,
        sycl::aspect::usm_atomic_shared_allocations,
        sycl::aspect::usm_system_allocations
    };

    int i = 0;
    for (const auto &a : asps) {
        if (d.has(a)) {
            std::cout << "Device has aspect " << i << std::endl;
        } else {
            std::cout << "Device does NOT have aspect " << i << std::endl;
        }
        ++i;
    }

    return 0;
}

still errors out on each of these aspects using intel/llvm DPC++ toolchain.

oleksandr-pavlyk avatar May 21 '21 22:05 oleksandr-pavlyk

Still the case in oneAPI 2020.3

oleksandr-pavlyk avatar Jul 20 '21 22:07 oleksandr-pavlyk

Some of these are now implemented in 2022.0 DPC++: https://github.com/intel/llvm/blob/bd68232bb96386bf7649345c0557ba520e73c02d/sycl/include/CL/sycl/aspects.hpp

Specifically:

atomic64
usm_atomic_host_allocations
usm_atomic_shared_allocations
usm_system_allocations

These will need to be added to dpctl.

oleksandr-pavlyk avatar Feb 02 '22 00:02 oleksandr-pavlyk

All listed aspects are not supported by DPC++ as of version 2024.1.0 .

The updated program

``cpp #include <CL/sycl.hpp> #include #include #include

int main(void) { sycl::device d {}; const auto &name = d.get_infosycl::info::device::name(); const auto &dver = d.get_infosycl::info::device::driver_version();

std::cout << "Device: " << name << " [" << dver << "]" << std::endl;

std::vector<sycl::aspect> asps = {
    sycl::aspect::emulated,
    sycl::aspect::host_debuggable,
    sycl::aspect::atomic64,
    sycl::aspect::usm_atomic_host_allocations,
    sycl::aspect::usm_atomic_shared_allocations,
    sycl::aspect::usm_system_allocations
};

int i = 0;
for (const auto &a : asps) {
    if (d.has(a)) {
        std::cout << "Device has aspect " << i << std::endl;
    } else {
        std::cout << "Device does NOT have aspect " << i << std::endl;
    }
    ++i;
}

return 0;

}


compiles with `icpx -fsycl asp.cpp -o asp` and outputs

(dev_dpctl) opavlyk@opavlyk-mobl:~/tmp$ ./asp Device: Intel(R) Graphics [0x9a49] [1.3.29138] Device does NOT have aspect 0 Device does NOT have aspect 1 Device has aspect 2 Device does NOT have aspect 3 Device does NOT have aspect 4 Device does NOT have aspect 5


The `dpctl.SyclDevice` only does not support querying the "emulated" aspect, to be added in 0.18 release.

Closing this issue.

oleksandr-pavlyk avatar May 21 '24 21:05 oleksandr-pavlyk