clvk icon indicating copy to clipboard operation
clvk copied to clipboard

Question on support for -cl-std=CL2.0

Open hooneecho opened this issue 9 months ago • 0 comments

I'd like to know if CLVK latest fully support "-cl-std=CL2.0" or not.

The reason why I ask here is that the return value of CL_DEVICE_OPENCL_C_ALL_VERSIONS is like below, which doesn't have 2.0.0.

    // Build list of supported OpenCL C versions
    m_opencl_c_versions = {
        MAKE_NAME_VERSION(1, 0, 0, "OpenCL C"),
        MAKE_NAME_VERSION(1, 1, 0, "OpenCL C"),
        MAKE_NAME_VERSION(1, 2, 0, "OpenCL C"),
        MAKE_NAME_VERSION(3, 0, 0, "OpenCL C"),
    };

https://github.com/kpet/clvk/blob/main/src/device.cpp#L767

BTW, given the subsitution vector below, It seems to work assuming that it can receive "-cl-std=CL2.0" as a compile option from the driver user/client.

    std::vector<std::pair<std::string, std::string>> option_substitutions = {
        // FIXME The 1.2 conformance tests shouldn't pass this option.
        //       It doesn't exist after OpenCL 1.0.
        {"-cl-strict-aliasing", ""},
        // clspv require entrypoint inlining for OpenCL 2.0 and OpenCL 3.0 (for
        // generic addrspace for example).
        {"-cl-std=CL2.0", "-cl-std=CL2.0 -inline-entry-points"},
        {"-cl-std=CL3.0", "-cl-std=CL3.0 -inline-entry-points"},
        {"-create-library", ""},
    };

https://github.com/kpet/clvk/blob/main/src/program.cpp#L925

Plus, Its compiler stack(CLSPV) is also supporting "-cl-std=CL2.0" AFAIK, so I believe It is enough to add 2.0 to m_opencl_c_versions.

Please correct me if I'm misunderstood or wrong.

hooneecho avatar Mar 04 '25 10:03 hooneecho