Bug 93977 - Clover does not respect alignment of pointer arguments
Summary: Clover does not respect alignment of pointer arguments
Alias: None
Product: Mesa
Classification: Unclassified
Component: Gallium/StateTracker/Clover (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Blocks: 99553
  Show dependency treegraph
Reported: 2016-02-03 08:14 UTC by Matt Arsenault
Modified: 2019-09-18 17:55 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Description Matt Arsenault 2016-02-03 08:14:16 UTC
The handling of arguments seems to not account for the required alignment of pointer kernel arguments. The alignment is tracked for the pointer value itself, but nothing is recording the alignment of the pointer element type needed for the runtime to provide the correctly aligned pointer.

I believe this is why the conformance test kernel_memory_alignment_local fails for all of the parameter tests. The global and constant versions seem to work, I'm assuming because every allocated buffer happens to have an alignment of 16 or higher anyway.

Also here:
         const unsigned arg_store_size = TD.getTypeStoreSize(arg_type);

         // OpenCL 1.2 specification, Ch. 6.1.5: "A built-in data
         // type that is not a power of two bytes in size must be
         // aligned to the next larger power of two".  We need this
         // alignment for three element vectors, which have
         // non-power-of-2 store size.
         const unsigned arg_api_size = util_next_power_of_two(arg_store_size);

TD.getTypeAllocSize(arg_type) should be used instead of manually rounding it.
Comment 1 Vedran Miletić 2017-03-22 16:29:18 UTC
Matt, did we fix this when fixing structs?
Comment 2 GitLab Migration User 2019-09-18 17:55:46 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/131.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.