src/libANGLE/validationCL.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi 897a5654 2024-10-16T10:32:16 CL: Rename isSet/isNotSet to intersects/excludes In particular, `isSet` was checking if _any_ bit was set instead of if _all_ bits were set. This was a point of confusion. Bug: angleproject:42266936 Change-Id: I76211a423f304fb4641ceb9cbfbb0bea4ff33ccf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5937411 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Austin Annestrand a2602533 2024-08-16T15:31:43 CL/VK: Update zero-enqueue validation checks According to the spec: CL_INVALID_GLOBAL_WORK_SIZE if global_work_size is NULL or if any of the values specified in global_work_size[0], …​ global_work_size[work_dim - 1] are 0. Returning this error code under these circumstances is deprecated by version 2.1. Since ANGLE supports OpenCL 3.0, we need to remove our "gws[dim] != 0" assert since this is no longer an error. Also adding missing check for LWS[dim] == 0 case since validationCL does not check for this prior to performing a modulo operation. Bug: angleproject:361750102 Tests-Fixed: OCLCTS.test_api.zero_sized_enqueue Change-Id: I02f302fd988bc37e3b52aeea30586843a47cadfd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5807300 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com>
Austin Annestrand c34e8c75 2024-08-16T14:06:10 CL: Platform check for ValidateCreateContextFromType Bug: angleproject:42266872 Change-Id: Iaf19a2bb6ca1e1a1ce7b02852a3e4fd5290bd557 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5807299 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Austin Annestrand 83ca89e5 2024-08-08T19:53:32 CL: Update logic for default platform on context creation In ANGLE, when multiple backends are enabled (e.g. passthrough, Vulkan, etc.), each backend is its own platform. Existing validation code was failing in this case for clCreateContext in the event of user not manually specifying CL_CONTEXT_PLATFORM. Spec says implementation then decides which platform to be associated with that context. ANGLE has a Platform::GetDefault() routine that was used and it simply grabs the 1st platform from our platform list in ANGLE (passthrough mode platform object in this case). We erroneously fail the validation in the case where we pass Vulkan device in our device_list since default-platform != Vulkan-platform. Updating the logic to use device's platform (from list) as default case. For clCreateContextFromType, we can continue to use Platform::GetDefault() as this routine generates the appropriate device list for the user to query/get via clGetContextInfo. Bug: angleproject:42266872 Change-Id: I285459688309d1cc76ade5a8564164a5538e1eda Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5789652 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Austin Annestrand d4abe622 2024-04-03T17:46:38 CL/VK: Implement enqueue NDRangeKernel & Task Adding support for: clEnqueueNDRangeKernel clEnqueueTask Bug: angleproject:8631 Change-Id: If57002be3ea00a55215e89ca47ab8fe9a422c6e7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5406614 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Austin Annestrand bc633ad7 2024-01-18T12:24:40 OpenCL/Vulkan: Implement compile and link routines Enables the following OpenCL APIs for the Vulkan Backend: clCompileProgram clLinkProgram Bug: angleproject:8571 Change-Id: Ide7d2911922347055051537c9c70b83be4e24575 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5341375 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Austin Annestrand 9fee9156 2024-01-18T13:50:38 OpenCL/Vulkan: Add initial CL Kernel routines Enables the following OpenCL APIs for Vulkan Backend: clCreateKernel clCreateKernels clSetKernelArg Bug: angleproject:8572 Change-Id: Iaaabd295d7951a48bf9bd6717ed3957960052dbd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5341376 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com>
Gowtham Tammana 3c08d696 2024-02-22T11:20:08 CL: Add DEVICE_NOT_FOUND case for context creation In the case where devices are not found, context creation should fail with CL_DEVICE_NOT_AVAILABLE error code. Adding that case. Bug: angleproject:8581 Change-Id: If52b40b85d110a3e490bcc4a0a95e7910941356d Signed-off-by: Gowtham Tammana <g.tammana@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5345829 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Austin Annestrand f85b6970 2024-01-18T11:59:24 OpenCL/Vulkan: Implement program get[Build]Info Adding backend routines for: - clGetProgramInfo - clGetProgramBuildInfo Bug: angleproject:8549 Change-Id: I890bb957e687a429eb0ed3b4756427ac98e302f3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5303565 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Austin Annestrand <a.annestrand@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Austin Annestrand 0ed0de4f 2024-01-18T10:47:50 OpenCL/Vulkan: Add initial program build support Introducing both clspv compiler lib integration, and clBuildProgram support. Internally we also add buildInternal() routine to abstract compile, link, and build phases. Output SPIR-V is also parsed internally via parseReflection() so that we can extract needed reflection information for CL runtime. Bug: angleproject:8549 Change-Id: If0563f4bea7ed0e04a13ea7a46c125c811d9c2a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5303564 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Gowtham Tammana e08e82b6 2024-01-31T20:48:14 CL: On kernel arg validation use right sizes The OpenCL C type `sampler_t` and `queue_t` map to API types `cl_sampler` and `cl_command_queue`[1]. Confirm the size checks accordingly. [1]: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_C.html#other-built-in-data-types Bug: angleproject:8543 Change-Id: Ia833561e2373ab32dd62271dfc515d7ea779c81a Signed-off-by: Gowtham Tammana <g.tammana@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5299720 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Austin Annestrand f8c06f10 2023-11-30T17:45:35 OpenCL: Add types to cl_mem origin and region Now using cl::MemOffset and cl::Coordinate. Bug: angleproject:8439 Change-Id: Id775fe78467d3b56d2a7cc87f793221ab5e04bc5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5078244 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Austin Annestrand 5e619b21 2023-11-29T14:56:59 OpenCL: DoubleFpConfig query validation fix There is currently a minor bug in the CL validation code that unconditionally validates "cl_khr_fp64" extension string when client queries for fp64 support. This is correct behavior for OpenCL 1.1 and lower. However for OpenCL 1.2 and greater, this became a core query for clGetDeviceInfo via "CL_DEVICE_DOUBLE_FP_CONFIG". Thus, on some 1.2 and greater implementations (ANGLE CL passthrough), this extension string wouldn't be specified since its a core API query in that case - and validation check will incorrectly fail via: ANGLE_VALIDATE_EXTENSION(info.khrFP64) Fix is to conditionally check this for the appropriate CL versions. Bug: angleproject:8436 Change-Id: Id2bb5699fa523061d738af19edb465a78dbd880d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5075775 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Austin Annestrand a9512a9f 2023-11-29T14:56:29 OpenCL: Replace error-return APIs to use angle::Result The motivation of converting existing CL APIs using "cl_int errorCode" to now use "angle::Result" is for better interop with internal ANGLE plumbing/abstractions. To facilitate this, we now make use of a TLS errorCode object that we set internally and read from entrypoint/stubs layer so that we can propagate back to user. Bug: angleproject:8435 Change-Id: I7c2a786019c33c56649be4b6e8b61bc318497bb1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5075772 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
John Plate 1891af05 2021-06-16T10:20:32 CL: Refactor TRY macro and fix more conformance bugs Bug: angleproject:6015 Change-Id: Id54be19822fec2ac5584ffe1d1cf5bb8f00c9094 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2967467 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: John Plate <jplate@google.com>
John Plate 69562546 2021-06-11T19:12:11 CL: Refactor info structs and fix conformance bug - Remove variable name prefix from Info structs to be more consistent with other ANGLE structs. - Fix CL object validation check with magics, since the Mesa solution doesn't work without RTTI. - Add support for some extensions required by OpenCL 1.1 and for some optional extensions. - Fix more conformance bugs. Bug: angleproject:6015 Change-Id: I41b1c45d95059a9994f5dc78bf9b74476cc6f2d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2956349 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
John Plate 2c8d9a9a 2021-06-09T16:09:35 CL: Remaining functions for OpenCL 1.2 Add support for the remaining functions for OpenCL 1.2 for the front end and pass-through back end. Also fix several bugs discovered by the conformance tests. Bug: angleproject:6015 Change-Id: I1dca1c3f4c1d9aea7f0501094c171116ea01381f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2954259 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: John Plate <jplate@google.com>
John Plate 55df3ec1 2021-06-08T18:57:15 CL: Add remaining enqueue commands Add support for remaining OpenCL 1.2 enqueue commands to front end and pass-through back end. Bug: angleproject:6015 Change-Id: Iab650e42d51e2105dc826088d3606c56d5cd0fd5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2944966 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: John Plate <jplate@google.com>
John Plate 82654e5d 2021-06-06T15:46:53 CL: Add program build commands Add program build commands to front end and pass-through back end. Bug: angleproject:6015 Change-Id: I1175646d35ff050796b718d7f0e269520292b319 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2940839 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
John Plate 2e772e04 2021-06-04T14:01:42 CL: Add image enqueue commands Add image enqueue commands to front end and pass-through back end. Bug: angleproject:6015 Change-Id: I133e84020975679fafd29432c965cd19f086d2b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2940837 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: John Plate <jplate@google.com>
John Plate 41b817f3 2021-05-31T17:38:43 CL: Add buffer enqueue commands Add buffer enqueue commands to front end and pass-through back end. Bug: angleproject:6015 Change-Id: I936530d31903e395550e4540339ebec2e6702e65 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2928425 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
John Plate baca10b7 2021-05-29T16:26:57 CL: Remove object cache and fix multi-threading All CL front end objects used to be cached to be able to determine if an object has been created by the front end to check its validity. The validity is now checked with the existence of an intrinsic value (the dispatch table pointer), which is consistent with the patterns found in Mesa and clvk (though clvk uses a magic value). This allows the removal of all cached objects. The cached objects were stored with std::unique_ptr. These are now gone and all remaining pointers are now custom intrinsic reference count pointers. Also remove global lock which causes deadlocks, e.g. when CL API is called from a separate thread to unlock a blocking call with a user event. Most of the front end is constant and already thread-safe. The ref count is also thread-safe now (atomic). A few remaining locks will follow. Without the global lock it was now possible to make the API reentrant, and to remove the workaround with the Khronos ICD loader to skip ANGLE's OpenCL library. Bug: angleproject:6001 Change-Id: I7d3b52db9011a02cb7ea9ebdeb6e22c4c702ef5b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2927395 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
John Plate 076974a9 2021-05-28T11:44:54 CL: event creation for front end & passthrough Add event object to back end and implement creation and info query. Bug: angleproject:6001 Change-Id: Id4951b726b66afa289fafe1a716a7cfdb6f5826d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2925477 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
John Plate 9459456b 2021-05-27T13:43:41 CL: kernel creation for front end & passthrough Add kernel object to back end and implement creation and info query. Bug: angleproject:6001 Change-Id: I6e3fdd2b35d7e73ed56144dc938bf21436d3559f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2922150 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
John Plate 51ab3dc3 2021-05-25T16:54:11 CL: Improve validation readablity Improve validation readablity by introducing a bit field class and by changing how the CL error code is returned. Bug: angleproject:6001 Change-Id: I51deb745454e5281de725481edef85eb30be28c7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2919690 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: John Plate <jplate@google.com>
John Plate 1aa88398 2021-05-24T14:19:05 CL: program object creation for front end and pass-through Add program object to back end and implement creation and info query. Bug: angleproject:6001 Change-Id: If94db8ab8b491e1ac21c767347cabb6f4f3b3cba Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2912465 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: John Plate <jplate@google.com>
John Plate e3dd7161 2021-05-24T12:47:38 CL: sampler object creation for front end and pass-through Add sampler object to back end and implement creation and info query. Bug: angleproject:6001 Change-Id: If5b7d09564d773d6aeda7612728e19bfec7f6155 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2912806 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
John Plate a6210a8f 2021-05-23T19:02:46 CL: image object creation for front end and pass-through Add image object to front end and implement creation and info query. Cache more Device info for Image validation. Bug: angleproject:5956 Change-Id: I38374f4c2c85287109c464ac90eb1bf49b07fa0a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2912805 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
John Plate efd8da4d 2021-05-21T15:39:11 CL: buffer object creation for front end and pass-through Add Buffer object to front end and Memory object to back end. Implement creation of buffer and sub-buffer objects. Make cl::Object destructor virtual to support destruction of Buffer. Cache more Device info for Buffer validation. Add missing and move existing version checks into validation. Bug: angleproject:5956 Change-Id: Iea7665be5f6bdd8469e81f5fe4935a9fb0e03436 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2912677 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: John Plate <jplate@google.com>
John Plate 6622d2b4 2021-05-18T21:26:39 CL: command queues for front end and pass-through Bug: angleproject:5956 Change-Id: I6d9d4e4e7dfc5402408e3b002e66e4eae752967d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2903091 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: John Plate <jplate@google.com>
John Plate a7ae63e4 2021-05-14T21:55:52 CL: Move object cast from entry points to stubs and front end Move the OpenCl object cast from the generated entry points to the stubs and front end, to make it possible to properly use static_cast. This removes the limitation that the front end objects have to be standard layout (and makes it possible to use virtual functions), which is consistent with other front end objects. Move the back end initialization from the stubs to the entry point functions, which fixes a bug where the back ends were not initialized during validation. Move more code from the stubs to the front end, to keep the stubs light. Remove unused function `default_return_value` from `generate_entry_points.py`. Bug: angleproject:5904 Change-Id: Id999ad6c537888017bf3252c6f6e088b7d4c7984 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2897245 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
John Plate 48b835cf 2021-05-09T22:47:00 CL: Implement context for front end and passthrough Bug: angleproject:5904 Change-Id: I23b764bba87be3a51a1b5b44b13968fc572efde9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2883773 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: John Plate <jplate@google.com>
John Plate b300dc52 2021-05-09T00:35:24 CL: device partitioning for front end and passthrough Partitioning is the creation of sub-devices. Also add reference counting for CL objects, which is needed now for sub-devices. Also fix CL print format strings, since cl_ulong is actually always 64 bit and not unsigned long. Bug: angleproject:5904 Change-Id: I006699fad2f953ce312bca87c9b6362b5d77a18a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2880665 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
John Plate e369a282 2021-05-08T14:08:28 Implement CL device object for front end and passthrough Bug: angleproject:5904 Change-Id: I17f6d10ed59c62fe9126d29b7de2c127c5d0039a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2880662 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: John Plate <jplate@google.com>
John Plate dfe208f1 2021-04-28T18:26:00 Add loader for CL pass-through back end Bug: angleproject:5904 Change-Id: If4960f3150f6bbc85a30f0f6ac5c9e668e6ff756 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2864022 Commit-Queue: John Plate <jplate@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
John Plate cddb2003 2021-04-23T18:26:51 Stubs for CL validation entry points Bug: angleproject:5775 Change-Id: Ic3b15efdf602bad8f5f170f03ba24b421a398ca8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2848504 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: John Plate <jplate@google.com>