Comments (4)
Note you'd still need an operation to extend these vectors before passing them to a shuffle as input.
That's not necessary. The result vector can have a different size than the two input vectors.
from clangir.
Current CIRGen may emit
%vi4res = cir.vec.create(..., %vi2a, %vi2b)
for the source OpenCL codevi4 vi4res = (vi4)(vi2a, vi2b)
, and end up with "inserting elements typedvi2
into a vector typedvi4
in LLVM IR".
I don't remember offhand. Does this seems like something done by design (i.e. we already have testcases for this) or is it something we forgot to verify?
Looking at VecCreateOp::verify
my impression is that this isn't supported, didn't you get verification errors?
The corresponding implementation from OG CodeGen is here. It uses shuffle operations to extend two vectors and merge the effective elements into the final result.
We can make it CIRGen or Lowering (keep the
cir.vec.create(%vi2a, %vi2b)
in CIR, rather than emitting shuffles immediately). I prefer CIRGen still.
Whatever we decide to do on CIRGen, we need to make sure that the corresponding LLVM lowering should match what OG codegen does (in this case it shall be series of shuffles). However, if we could do better in CIRGen to map the semantics in a more clear way, we should do it - if we emit shuffles in CIRGen we make it potentially harder to retrieve original information, because we need to look into the shuffle and recognize it's just joining two smaller vectores.
I'd prefer avoiding shuffles this early for this, but if it's something we are already doing, then it wouldn't be inconsistent (and we can later improve by adding other ops). I'd also be fine with improving cir.vec.create
to support the "building from smaller vectors" scenary. Another option would be to introduce operations for extending number of lanes and use that result to build the vectors, but not sure how well that feds into cir.vec.create
later.
@dkolsen-pgi, suggestions on what do you think might play better here?
from clangir.
GNU vectors do not support concatenating two vectors with the syntax:
vi4 res = (vi4)(a, b);
So I haven't implemented that in CIR.
I think this is best implemented with cir.vec.shuffle
rather than cir.vec.create
. Concatenating two vectors is one of the things that shufflevector is designed to do.
from clangir.
Works for me, though a concat op would be cool too, but perhaps we could wait until we actually have a pass that'd prefer saving some compile time by not having to look at the mask to reconstruct the concat.
Note you'd still need an operation to extend these vectors before passing them to a shuffle as input. We could probably use some form of cast for that.
from clangir.
Related Issues (20)
- LLVM IR dialect already supports zeroinitializer, get rid of `ZeroInitConstOp` HOT 2
- Case gnu range need to be improved HOT 4
- Add an CIR analysis-only pipeline that uses traditional codegen HOT 6
- Can we create a LoweringHelpers for LowerCIRToMLIR similar to ToLLVM? HOT 1
- Not completely implemented `CIRGenTypes::getRecordTypeName` HOT 10
- Implement a custom CIR Module Op and attributes HOT 2
- Use shared libs for github actions HOT 8
- [ClangIR][CIRGenFunction] implement buildToMemory HOT 1
- [ThroughMLIR] Cannot lower function with pointer arguments HOT 1
- Should use `getCalleeAttr` when lowering `CallOp`
- Should mark private visibility for extern symbols.
- Vector related arith missing `nsw` on addition HOT 2
- Revisit insertion point being restored by an InsertionGuard in `buildSwitchBody()` HOT 1
- [Umbrella] Switch stmt CIRGen issues
- Single-operand vector shuffling HOT 1
- [ThroughMLIR] cir-opt can not work when lowering ForOp to scf HOT 4
- Add a test for arrays of 3-component extended vectors
- Crash with try statement HOT 1
- [GSoC] Add OpenCL support to compile GPU kernels
- Reinstate #668 and #678 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clangir.