[Mesa-dev] [PATCH] clover: Don't extend illegal integer types.
Jan Vesely
jan.vesely at rutgers.edu
Thu Jul 26 20:13:24 UTC 2018
On Thu, 2018-07-26 at 10:51 -0700, Francisco Jerez wrote:
> Jan Vesely <jan.vesely at rutgers.edu> writes:
>
> > It's OK to pass them in memory, which is what kernel invocation needs.
> > Fixes AMDGCN regressions since llvm r337535 ("Reapply "AMDGPU: Fix handling of alignment padding in DAG argument lowering"):
> > scalar-arithmetic-char
> > scalar-arithmetic-uchar
> > scalar-arithemtic-short
> > scalar-arithmetic-ushort
> > scalar-comparison-char
> > scalar-comparison-uchar
> > scalar-comparison-short
> > scalar-comparison-ushort
> >
> > Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
>
> Reviewed-by: Francisco Jerez <currojerez at riseup.net>
thank you. I added cc: stable and pushed both patches.
Jan
>
> > ---
> > src/gallium/state_trackers/clover/llvm/codegen/common.cpp | 3 +--
> > src/gallium/state_trackers/clover/llvm/compat.hpp | 12 ++++++++++++
> > 2 files changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> > index ddf2083f37..ca5f78940d 100644
> > --- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> > +++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> > @@ -85,8 +85,7 @@ namespace {
> > const unsigned arg_store_size = dl.getTypeStoreSize(arg_type);
> > const unsigned arg_api_size = dl.getTypeAllocSize(arg_type);
> >
> > - const auto target_type = !arg_type->isIntegerTy() ? arg_type :
> > - dl.getSmallestLegalIntType(mod.getContext(), arg_store_size * 8);
> > + const auto target_type = compat::get_abi_type(arg_type, mod);
> > const unsigned target_size = dl.getTypeStoreSize(target_type);
> > const unsigned target_align = dl.getABITypeAlignment(target_type);
> >
> > diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp b/src/gallium/state_trackers/clover/llvm/compat.hpp
> > index 60270d1529..975012cbda 100644
> > --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
> > +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
> > @@ -153,6 +153,18 @@ namespace clover {
> > return tm.addPassesToEmitFile(pm, os, nullptr, ft);
> > #else
> > return tm.addPassesToEmitFile(pm, os, ft);
> > +#endif
> > + }
> > +
> > + template<typename T, typename M>
> > + T get_abi_type(const T &arg_type, const M &mod) {
> > +#if HAVE_LLVM >= 0x0700
> > + return arg_type;
> > +#else
> > + ::llvm::DataLayout dl(&mod);
> > + const unsigned arg_store_size = dl.getTypeStoreSize(arg_type);
> > + return !arg_type->isIntegerTy() ? arg_type :
> > + dl.getSmallestLegalIntType(mod.getContext(), arg_store_size * 8);
> > #endif
> > }
> > }
> > --
> > 2.16.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
--
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180726/8d4c0fe3/attachment-0001.sig>
More information about the mesa-dev
mailing list