summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
3 daysclover: fix array images view creationDave Airlie1-1/+5
Found this on top of Karol's patches but it seems like it can just be applied to master. Helps with some cases of kernel_image_methods/test_kernel_image_methods 2Darray Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9381>
4 daysclover: Add missing include for llvm-12 build fixKarol Herbst1-0/+1
Fixes: d1eab2b1eb1 ("clover: Fix build with llvm-12.") Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9372>
5 daysclover: Fix build with llvm-12.Karol Herbst2-7/+20
Fix build error after LLVM commit c495dfe0268b ("[clang][cli] NFC: Decrease the scope of ParseLangArgs parameters"). ../src/gallium/frontends/clover/llvm/invocation.cpp: In function ‘std::unique_ptr<clang::CompilerInstance> {anonymous}::create_compiler_instance(const clover::device&, const string&, const std::vector<std::__cxx11::basic_string<char> >&, std::string&)’: ../src/gallium/frontends/clover/llvm/invocation.cpp:252:55: error: cannot convert ‘clang::PreprocessorOptions’ to ‘std::vector<std::__cxx11::basic_string<char> >&’ 252 | c->getPreprocessorOpts(), | ~~~~~~~~~~~~~~~~~~~~~~^~ | | | clang::PreprocessorOptions Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4114 Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8543>
10 daysclover: implement CL_IMAGE_NUM_MIP_LEVELS and CL_IMAGE_NUM_SAMPLESAaron Watry1-0/+8
Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Serge Martin <edb@sigluy.net> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9212>
10 daysclover: Implement CL_MEM_OBJECT_IMAGE1DEdward O'Callaghan4-1/+47
v2: Consider surface height as valid when unused by using 1. Fixup width boundary checking. v3 (Karol): Pull in changes from later commits Fix validation Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9212>
10 daysclover: rework quering image max sizesKarol Herbst5-12/+14
The 3D one was always wrongly used, also the consumers always wanted the size, not the levels. This should make it easier to use the interface and also prevent future bugs like the 3D one. Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9212>
10 daysclover: implement CL_IMAGE_ELEMENT_SIZEAaron Watry1-1/+1
v2 (Karol Herbst): extracted from other commit Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Serge Martin <edb@sigluy.net> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9212>
10 daysclover: simplify image argumentsKarol Herbst4-29/+29
We don't care how many dimensions the image arg has, so drop it otherwise we would have to add a lot of variants for arrays, msaa and depth combinations. Yes, image2d_array_msaa_depth_t is a thing. Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Serge Martin <edb@sigluy.net> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9212>
10 daysclover: return CL_INVALID_VALUE when origin or region are NULLSerge Martin1-0/+2
Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9212>
2021-02-16clover: Add -fgnu89-inline to Clang command lineJesse Natalie1-1/+1
Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9085>
2021-02-02nir: Drop the lower_mem_constant_vars declarationJason Ekstrand1-3/+0
The function was removed in c730ace12b51d46585fac6710fbe57dccd67071c. Fixes: c730ace12b5 "nir,clover: Drop nir_lower_mem_constant_vars" Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8834>
2021-02-02clover/api: make use of validate_mem_migration_flags in ↵Karol Herbst1-4/+1
clEnqueueMigrateMemObjects Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6401>
2021-02-02clover: implement clEnqueueSVMMigrateMemJérôme Glisse3-5/+70
Memory migration for SVM (share virtual memory). This allow to migrate a range of virtual address of the process to device memory to speed up device processing when that memory is in use by the device. v2 (Karol): use tracked SVM allocation in order to support cases where the size of the migration is not specified Signed-off-by: Jérôme Glisse <jglisse@redhat.com> Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6401>
2021-02-02clover: track allocated svm pointersKarol Herbst4-3/+53
We need those to proper validate the SVM API. v2: use std::map instead of std::unordered_map v3: guard against segfaults on std::prev with empty containers Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6401>
2021-01-26clover: Add constructor for global_argument.Vinson Lee2-0/+5
Fix defects reported by Coverity Scan. member_not_init_in_gen_ctor: The compiler-generated constructor for this class does not initialize buf. member_not_init_in_gen_ctor: The compiler-generated constructor for this class does not initialize svm. Signed-off-by: Vinson Lee <vlee@freedesktop.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8623>
2021-01-08clover: Add constructor for clover::module.Vinson Lee1-0/+1
Fix defect reported by Coverity Scan after commit 95527fe2292 ("clover/module: add a printf support to module (v5)"). Uninitialized scalar variable (UNINIT) uninit_use_in_call: Using uninitialized value m.printf_strings_in_buffer when calling module. Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8322>
2021-01-01clover: Expose cl_khr_extended_versioningPierre Moreau1-0/+1
With the extension specification merged in and the last query now supported, the extension can be advertised. v2: Fix indentation (Dave Airlie) Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover: Implement clCreateProgramWithIL from OpenCL 2.1Pierre Moreau2-9/+8
v2: Remove clCreateProgramWithIL from api/invalid.cpp Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover: Advertise cl_khr_il_programPierre Moreau2-0/+6
v2: * Change the code to avoid the macro (Karol Herbst, Francisco Jerez); * Update the code to add a `cl_name_version`. Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover/api: Implement CL_DEVICE_IL_VERSIONPierre Moreau1-3/+21
v2: Move `supported_il_versions_as_string()` from `device` to an anonymous namespace, and remove the static storage of the results (Francisco Jerez) Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover: Handle CL_PROGRAM_IL in clGetProgramInfoPierre Moreau1-2/+4
Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover: Implement clCreateProgramWithILKHRPierre Moreau5-16/+100
v2: Use the same storage for OpenCL C sources and ILs representations (Karol Herbst, Francisco Jerez) v3: * Remove `program::has_source` and instead add a value to `program::il_type` for sources. (Francisco Jerez) * Use `std::move()` on sources. * Replace `CL_MAKE_VERSION(99999999u, 0u, 0u)` with `std::numeric_limits<uint32_t>::max()` (Francisco Jerez) Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover: List supported ILs versionsPierre Moreau2-0/+7
v2: * Change the existing method to return a `std::vector<cl_name_version`; * Add a string function that uses the previous method but returns a `std::string`. v3: * Remove `supported_il_versions_as_string()` (Francisco Jerez) Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover/spirv: Use cl_version for SPIR-V versions (v2)Pierre Moreau3-11/+6
v2: Explicitly construct the cl_name_version object. Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover/spirv: Add function checking the SPIR-V versionPierre Moreau2-0/+47
An OpenCL implementation advertising a certain version of the API does not have to support all existing version: some versions are mandatory but not all. For example, the OpenCL 2.1 Specification mentions that conforming implementations have to support SPIR-V 1.0, but only might support higher versions. Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover/spirv: Change API to use std::string binariesPierre Moreau3-20/+21
clover::program stores IL representations using a std::string, so change the API to also use std::string to avoid copies and additional allocations. Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover/spirv: Add function checking whether a binary contains SPIR-VPierre Moreau2-0/+26
v2: Change API to take a std::string Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01clover/spirv: Add version conversion utilitiesPierre Moreau2-0/+28
SPIR-V and OpenCL encodes differently version numbers and since SPIR-V version numbers are reported in OpenCL, there is a need for utilities to convert back and forth. Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2078>
2021-01-01panfrost: Allow NULL for some binding functionsIcecream951-1/+7
Handle Clover passing NULL to bind_sampler_states and set_sampler_views when cleaning up after launching a job. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8264>
2021-01-01pan/mdg: Implement load_global_invocation_idIcecream951-0/+5
NIR generates global_invocation_id, but Clover lowers it to global_invocation_id_zero_base. It isn't lowered for OpenGL, so we need to support both intrinsics. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8264>
2020-12-28microsoft/clc: Hook up printfJesse Natalie5-76/+81
Rewrites the original lowering pass to use the one shared with Clover, instead only handling the new load_printf_buffer_address intrinsic. Exports the new metadata to the runtime containing strings and arg sizes. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>
2020-12-29clover/nir: hookup printf (v3)Dave Airlie1-1/+46
This connects printf up for NIR drivers, it lowers using the NIR pass where it places the idx to the strings into the output buffer. It also sets the global buffer header to the nir paths. v2: remove dead function temps after lowering v3: move to single string Acked-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>
2020-12-29clover: add core clover printf support (v12)Serge Martin10-5/+327
"The implementation is based on what LLVM AMD target expect. The compiler provided an id link to argument desc and format used. The runtime need to store them to be able to parse the buffer filled by the device during the kernel execution, ie, an id value to find the format and followed by the arguments values" v2: airlied Split out the core code to a separate patch, add support for the different global buffer formats, and move the LLVM specific code as much as possible to the backend. v3: handle strings differences better llvm backend stores strings to the printf buffer nir backend stores them to a sideband storage in NIR and stores an index in the buffer. v4: move specifier parsing to util code. v5: rename buffer fmt + make printf code work v6: handle args/specifier number mismatch support v7: move to single string + struct v8: use "%s" to print strings to avoid bad specifier, fix str calcs. v9: move to the same global buffer format as llvm, just strings are different now. This requires changes to nir lowering. buffer format: [0] contains offset into buffer at start contains 8 [1] contains length of buffer v10: printf const clean, add warning, endian assert, print %% at end, fix specifiers to vector v11: minor cleanups, make sure the format string never contains an n. v12: validate format string Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>
2020-12-29clover/module: add a printf support to module (v5)Dave Airlie2-0/+21
This adds storage for printf formats encoded as number of argument sizes + the printf format string, and storage for sideband printf strings if the backend wants them. It adds a flag that decides if the backend wants AMD (LLVM) behaviour or NIR wrt the format of the global buffer and how to decode strings. Based on work by EdB in his printf support, but made useful to be generic. I'm not a huge fan of the buffer format flag, but this was the easiest way to denote the llvm abi buffer format. v3: rename buffer fmt v4: use a single strings storage and one struct v5: move printf_info into module, cleanup serialisation struct Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>
2020-12-29util: add printf specifier shared helper code.Dave Airlie4-0/+98
clover needs to walk valid specifiers in C++, vtn needs to find string specifiers in C, let's do both. This writes the format walker in C++, and wraps it with C. Acked-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>
2020-12-18clover/api: Add extended versioning query for OpenCL CPierre Moreau1-0/+4
The cl_khr_extended_versioning extension differs from the OpenCL 3.0 version on this specific as it only reports a single supported OpenCL C version, whereas the OpenCL 3.0 equivalent will report all of them. Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7590>
2020-12-18clover/api: Add extended versioning query for built-in kernelsPierre Moreau1-1/+4
Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Pierre Moreau <dev@pmoreau.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7590>
2020-12-05ci: Drop x86_build_old imageMichel Dänzer2-83/+0
Currently not used for anything. v2: * Drop build script as well (Eric Anholt) Fixes: a3543adc2628 "clover: set LLVM min version to 8.0.1" Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7902>
2020-12-04clover/core: Fix x86 buildJesse Natalie1-1/+1
I unintentionally removed this size_t cast, which is required for std::max to infer its single template arg. Fixes: f88347cd ("clover/core: Support MSVC") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3920 Reviewed-by: Marcin Slusarz <marcin.slusarz@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7905>
2020-12-02clover: Use .def files for exports on WindowsJesse Natalie3-0/+132
v2: Move .def files to opencl target Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02clover/api: Support MSVCJesse Natalie3-2/+8
Three things: 1. MSVC dislikes mismatching declaration/definition of __declspec(dllexport). Since CL headers don't have the declspec, the implementations should't either. 2. An unnamed brace-initialization gets deduced as an initializer list, instead of a brace-constructed string. Just add the type name. 3. posix_memalign doesn't exist on Windows. Reviewed-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02clover/core: Support MSVCJesse Natalie2-20/+21
Constructing a class where the class name is wrapped in parens doesn't work with MSVC. I see no good reason to do that so drop the parens. Also, use a generic page size helper instead of hardcoding something OS-specific. Reviewed-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02clover/llvm: Work around MSVC quirksJesse Natalie5-12/+23
Two things: 1. While instantiating a template where clover::llvm and ::llvm are both resolvable for unscoped llvm, MSVC complains about ambiguity. Resolve by not using namespace clover, leaving only ::llvm as a valid namespace. 2. LLVM headers (specifically Allocator.h) use __declspec(restrict), but Mesa's util headers #define restrict to __restrict for C++. Since __declspec(__restrict) is invalid, make sure we always include Allocator.h first before the util header. 3. Change a uint/int to uint64_t to match the type returned from LLVM. Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02clover: Fix property_element::as for MSVCJesse Natalie1-2/+8
MSVC doesn't like reinterpret_cast<T>(val) where neither T nor val are pointers. It needs to be a static cast instead. v2: Update assert to static_assert Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02meson: Adjust Clover's required LLVM modulesJesse Natalie1-2/+3
When coming from CMake, all-targets doesn't exist, and Clover's mechanism for finding Clang apparently requires the OpenMP frontend lib but doesn't automatically pull it in. Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02clover: Add version.lib dependency for Clang on WindowsJesse Natalie1-1/+9
Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02clover: Support LLVM coming from CMake instead of config-toolJesse Natalie2-2/+2
Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02clover: Add opencl-native build flagJesse Natalie4-4/+36
This flag controls whether to include native codegen functionality for the AMD backend Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-11-24clover: Fix typo in comment.Vinson Lee1-1/+1
Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7702>
2020-11-20clover: Initialize command_queue member _props.Vinson Lee1-1/+1
Fix defect reported by Coverity Scan. Uninitialized scalar variable (UNINIT) uninit_use: Using uninitialized value this->_props. _props |= properties[i + 1]; Fixes: e42a7fa0378 ("clover: add support command queue properties") Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7701>