Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Issue 2380023002: [SubZero] Vector types support for MIPS (Closed)

Created:
4 years, 2 months ago by jaydeep.patil
Modified:
4 years, 2 months ago
CC:
native-client-reviews_googlegroups.com, rich.fuhler_imgtec.com, simon.dardis_imgtec.com, matthew.fortune_imgtec.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

[SubZero] Vector types support for MIPS This patch implements vector operations on MIPS32 using VariableVecOn32 method (on the lines of Variable64On32). Vector operations are scalarized prior to lowering. Each vector variable is split into 4 containers to hold a variable of vector type. For MIPS32, four GP/FP registers are used to hold a vector variable. Arguments are passed in GP registers irrespective of the type of the vector variable. Lit test vector-mips.ll has been added to test this implementation. R=stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=958ddb75696187bd45682d464b5b2eb8ca378e06

Patch Set 1 #

Total comments: 18

Patch Set 2 : Addressed review comments #

Total comments: 38

Patch Set 3 : Addressed review comments #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+936 lines, -102 lines) Patch
M src/IceCfg.cpp View 1 2 2 chunks +14 lines, -5 lines 0 comments Download
M src/IceInstMIPS32.h View 1 1 chunk +4 lines, -5 lines 0 comments Download
M src/IceOperand.h View 1 2 2 chunks +61 lines, -0 lines 0 comments Download
M src/IceTargetLowering.h View 1 2 2 chunks +9 lines, -0 lines 0 comments Download
M src/IceTargetLowering.cpp View 1 2 chunks +8 lines, -0 lines 0 comments Download
M src/IceTargetLoweringMIPS32.h View 1 2 5 chunks +12 lines, -3 lines 1 comment Download
M src/IceTargetLoweringMIPS32.cpp View 1 2 32 chunks +582 lines, -89 lines 1 comment Download
A tests_lit/llvm2ice_tests/vector-mips.ll View 1 chunk +246 lines, -0 lines 0 comments Download

Messages

Total messages: 20 (5 generated)
jaydeep.patil
4 years, 2 months ago (2016-09-29 12:45:49 UTC) #3
Jim Stichnoth
Initial comments. I haven't looked at the big file yet. https://codereview.chromium.org/2380023002/diff/1/src/IceCfg.cpp File src/IceCfg.cpp (right): https://codereview.chromium.org/2380023002/diff/1/src/IceCfg.cpp#newcode123 ...
4 years, 2 months ago (2016-09-29 16:50:26 UTC) #5
jaydeep.patil
https://codereview.chromium.org/2380023002/diff/1/src/IceCfg.cpp File src/IceCfg.cpp (right): https://codereview.chromium.org/2380023002/diff/1/src/IceCfg.cpp#newcode123 src/IceCfg.cpp:123: if (Target->shouldSplitToVariableVecOn32(Ty)) { On 2016/09/29 16:50:25, stichnot wrote: > ...
4 years, 2 months ago (2016-09-30 07:02:51 UTC) #6
Jim Stichnoth
A few more comments apart from the lowering file. One question in the meantime. Is ...
4 years, 2 months ago (2016-09-30 15:41:59 UTC) #7
Jim Stichnoth
I really haven't looked that deeply into the actual vector lowering sequences. I'll have much ...
4 years, 2 months ago (2016-09-30 17:37:40 UTC) #8
jaydeep.patil
On 2016/09/30 17:37:40, stichnot wrote: > I really haven't looked that deeply into the actual ...
4 years, 2 months ago (2016-10-01 05:43:33 UTC) #9
jaydeep.patil
4 years, 2 months ago (2016-10-01 05:46:34 UTC) #10
jaydeep.patil
On 2016/09/30 15:41:59, stichnot wrote: > A few more comments apart from the lowering file. ...
4 years, 2 months ago (2016-10-01 05:55:43 UTC) #11
jaydeep.patil
4 years, 2 months ago (2016-10-01 05:58:19 UTC) #12
jaydeep.patil
https://codereview.chromium.org/2380023002/diff/20001/src/IceCfg.h File src/IceCfg.h (right): https://codereview.chromium.org/2380023002/diff/20001/src/IceCfg.h#newcode332 src/IceCfg.h:332: Variable *ImplicitRet; /// Implicit return On 2016/09/30 17:37:39, Jim ...
4 years, 2 months ago (2016-10-03 06:38:56 UTC) #13
Jim Stichnoth
LGTM. (I went ahead and fixed the minor comments.) https://codereview.chromium.org/2380023002/diff/40001/src/IceTargetLoweringMIPS32.cpp File src/IceTargetLoweringMIPS32.cpp (right): https://codereview.chromium.org/2380023002/diff/40001/src/IceTargetLoweringMIPS32.cpp#newcode2400 src/IceTargetLoweringMIPS32.cpp:2400: ...
4 years, 2 months ago (2016-10-03 14:52:23 UTC) #14
Jim Stichnoth
Committed patchset #3 (id:40001) manually as 958ddb75696187bd45682d464b5b2eb8ca378e06 (presubmit successful).
4 years, 2 months ago (2016-10-03 14:52:52 UTC) #16
jaydeep.patil
On 2016/10/03 14:52:52, Jim - vacation through Oct. 4 wrote: > Committed patchset #3 (id:40001) ...
4 years, 2 months ago (2016-10-04 03:07:03 UTC) #17
jaydeep.patil
On 2016/10/01 05:43:33, jaydeep.patil wrote: > On 2016/09/30 17:37:40, stichnot wrote: > > I really ...
4 years, 2 months ago (2016-10-06 12:50:15 UTC) #19
Simon.Dardis_imgtec.com
4 years, 2 months ago (2016-10-11 15:07:04 UTC) #20
Message was sent while issue was closed.
Hi Jim,

I’m the code owner of the MIPS backend in LLVM. For MIPS, our ABI requires that
vectors
are passed in integer registers, so a C function with a signature like:

v4i32 fcmpOeq(v4f32 a, v4f32 b)

is lowered to LLVM IR by Clang with a signature like:

declare inreg { i32, i32, i32, i32 } @fcmpOeqVector(i32 inreg, i32 inreg, i32
inreg, i32 inreg, i32 inreg, i32 inreg, i32 inreg, i32 inreg)

Passing the vector argument through the integer registers. Other targets such as
X86_64, AArch64 would lower this to:

<4 x i32> define @fcmpoeq(<4 x float>, <4 x float>)

and pass the arguments through vector registers.

Currently the MIPS backend in LLVM will tolerate functions with <4 x float> but
will pass the vector as four floats according
to the ABI in use. This unintentional support however does not current work with
MSA, our latest vector instruction set.

I'm investigating what level of changes would be required to support <4 x float>
& co. directly as per our ABIs but this handling
was traditionally never required for MIPS as we've encoded the argument lowering
directly into LLVM-IR. As such, I have concerns
about the maintenance effort.

I can see from the crosstest suite that the vector operations test uses that
type signature. Is it expected all targets are to use
those tests?

Thanks,
Simon

From: jaydeep.patil@imgtec.com [mailto:jaydeep.patil@imgtec.com] 
Sent: 06 October 2016 13:50
To: kschimpf@google.com; jpp@chromium.org; stichnot@chromium.org;
eholk@chromium.org; Sagar Thakur
Cc: native-client-reviews@googlegroups.com; Rich Fuhler; Simon Dardis; Matthew
Fortune
Subject: Re: [SubZero] Vector types support for MIPS (issue 2380023002 by
jaydeep.patil@imgtec.com)

On 2016/10/01 05:43:33, jaydeep.patil wrote:
> On 2016/09/30 17:37:40, stichnot wrote:
> > I really haven't looked that deeply into the actual vector lowering
sequences.
> 
> > I'll have much higher confidence once the cross tests are running. The main
> > thing that cross tests might not catch would be if there's something weird
and
> > incorrect about the lowering that doesn't trigger a liveness validation
> failure
> > but manifests itself in the register allocator on larger functions.
> 
> I have tried running test_fcmp cross test but found an issue with the calling
> convention (Clang vs pnacl-llc).
> In pnacl-llc, the <4 x float> type is treated differently than its C version
> v4f32. 
> We use <4 x float> type in test_fcmp_pnacl.ll and v4f32 in its driver .cpp
file.
> 
> The cross test framework assumes that these two types are same.
> However pnacl-llc treats <4 x float> as array of float type and uses MIPS FP
> registers $f12,$f14 etc. for arguments.
> We are using v4f32 type in driver .cpp file to call fcmpXXXVector function
> defined in .ll file. 
> The driver .cpp file is compiled using Clang. 
> Clang v4f32 treats it as vector of 4 elements and uses MIPS GP registers
$4-$7
> to call fcmpXXXVector.
> Thus $f12,$f14 are never setup by the caller, and the callee uses them
without
> actual def.
> I will talk to the MIPS LLVM compiler and get some clarification on this.
> 
> Once the support for vector type and cast is available then it will be very
easy
> to run the cross tests.

Hi Jim,

Adding Matthew Fortune and Simon Dardis for discussion on <4 x float> vs v4f32
type.

Regards,
Jaydeep


https://codereview.chromium.org/2380023002/

-- 
You received this message because you are subscribed to the Google Groups
"Native-Client-Reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to native-client-reviews+unsubscribe@googlegroups.com.
To post to this group, send email to native-client-reviews@googlegroups.com.
Visit this group at https://groups.google.com/group/native-client-reviews.
For more options, visit https://groups.google.com/d/optout.

Powered by Google App Engine
This is Rietveld 408576698