Page MenuHomePhabricator

junaire (Jun Zhang)
User

Projects

User does not belong to any projects.

User Details

User Since
Nov 25 2021, 4:22 AM (8 w, 5 d)

Recent Activity

Fri, Jan 21

junaire added a comment to D117829: [Clang] Add integer add/mul reduction builtins.

@junaire has been looking into this and put up D117480 as an option to extend the intrinsic to have a dedicated order argument.

Hi @fhahn, I wonder if we should continue working on this as I remember one of the reviewers was doubted this change.

Fri, Jan 21, 4:34 AM · Restricted Project

Mon, Jan 17

junaire added a comment to D117480: [IR] Extend llvm.vector.reduce.fadd.

I don't get this change. We already use reassoc FMF to allow a non-ordered reduction, what's the purpose of the new flag?

This also needs a LangRef update.

Mon, Jan 17, 6:56 AM · Restricted Project
junaire added a comment to D117480: [IR] Extend llvm.vector.reduce.fadd.

Please note that this patch is WIP.

Mon, Jan 17, 6:52 AM · Restricted Project
junaire requested review of D117480: [IR] Extend llvm.vector.reduce.fadd.
Mon, Jan 17, 6:42 AM · Restricted Project

Fri, Jan 14

junaire committed rG8de0c1feca28: [Clang] Add __builtin_reduce_or and __builtin_reduce_and (authored by junaire).
[Clang] Add __builtin_reduce_or and __builtin_reduce_and
Fri, Jan 14, 6:07 AM
junaire closed D116736: [Clang] Add __builtin_reduce_or and __builtin_reduce_and.
Fri, Jan 14, 6:06 AM · Restricted Project

Thu, Jan 13

junaire added a comment to D116736: [Clang] Add __builtin_reduce_or and __builtin_reduce_and.

@junaire did you already get commit access or should I commit this change on your behalf?

Thu, Jan 13, 9:08 PM · Restricted Project

Wed, Jan 12

junaire added a comment to D116736: [Clang] Add __builtin_reduce_or and __builtin_reduce_and.

LGTM, thanks!

The last __builtin_reduce_add will be separated into another one.

Are you planning on putting up a patch for this one as well? What makes add a bit different is that ‘llvm.vector.reduce.fadd.*’ can only perform reductions either in the original order or in an unspecified order. For the extension, we need a particular evaluation order (reduction tree adding adjacent element pairs). Technically this order is required for all reduction builtins, but for integers the order doesn't matter, same for min/max.

Wed, Jan 12, 10:17 PM · Restricted Project

Mon, Jan 10

junaire updated the diff for D116736: [Clang] Add __builtin_reduce_or and __builtin_reduce_and.

fix the comment.

Mon, Jan 10, 9:54 PM · Restricted Project

Fri, Jan 7

junaire committed rG5be131922cb7: [NFC] Test commit. (authored by junaire).
[NFC] Test commit.
Fri, Jan 7, 6:40 PM

Thu, Jan 6

junaire requested review of D116736: [Clang] Add __builtin_reduce_or and __builtin_reduce_and.
Thu, Jan 6, 3:57 AM · Restricted Project
junaire retitled D115936: [ASTMatcher] Add a new matcher called isInTopNamespace from [Clang] Add isInNamespace() to check if a Decl in a specific namespace to [ASTMatcher] Add a new matcher called isInTopNamespace.
Thu, Jan 6, 3:52 AM · Restricted Project
junaire updated the diff for D115936: [ASTMatcher] Add a new matcher called isInTopNamespace.

After Aarron's comments, I realize what I really want to do is add a new
ASTMatcher that matches declarations what in the top level namespace like std.

Thu, Jan 6, 3:48 AM · Restricted Project

Wed, Jan 5

junaire added a comment to D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..

LGTM, thanks!

Wed, Jan 5, 5:22 AM · Restricted Project

Tue, Jan 4

junaire added a comment to D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

@junaire please let me know if you want me to land this on your behalf.

Yeah, thanks a lot!

You can use:
Jun Zhang
jun@junz.org

Committed! After D115429, I'd recommend you obtain commit access https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

Tue, Jan 4, 4:23 AM · Restricted Project
junaire added a comment to D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..

This now needs a rebase after landing 5c57e6aa5777, then it should be good to go.

Tue, Jan 4, 4:14 AM · Restricted Project
junaire updated the diff for D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..

rebase to main.

Tue, Jan 4, 4:11 AM · Restricted Project
junaire added a comment to D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

@junaire please let me know if you want me to land this on your behalf.

Tue, Jan 4, 2:16 AM · Restricted Project

Tue, Dec 28

junaire updated the diff for D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

Refactor code a little bit and fix wrong names.

Tue, Dec 28, 11:35 PM · Restricted Project
junaire retitled D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic. from [Clang] Add an overload for emitUnaryBuiltin. to [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..
Tue, Dec 28, 11:18 PM · Restricted Project
junaire updated the diff for D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

Extend emitUnaryBuiltin instead of adding a new overload, also apply it to __builtin_elementwise_abs.

Tue, Dec 28, 11:17 PM · Restricted Project
junaire updated the diff for D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

In order to use emitUnaryBuiltin in other cases, I changed the function interface.
This allows us to use it in all Builder.CreateUnaryIntrinsic() cases, but will make
the function body very small.

Tue, Dec 28, 12:26 AM · Restricted Project

Dec 24 2021

junaire added a comment to D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..
35:  %0 = load float, float* %f1.addr, align 4 
36:  %1 = load float, float* %f1.addr, align 4 
37:  %elt.abs = call float @llvm.fabs.f32(float %1)

It looks like the argument expression is evaluated twice. Did you remove the Value *Op0 = EmitScalarExpr(E->getArg(0)); calls?

Dec 24 2021, 7:10 AM · Restricted Project
junaire added a comment to D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

I confirmed that we can use emitUnaryBuiltin in the cases you pointed out. Please see the logs below:

$ path/to/llvm-project/build/bin/clang -cc1 -internal-isystem /path/to/llvm-project/build/lib/clang/14.0.0/include -nostdsysteminc -triple x86_64-apple-darwin /path/to/llvm-project/clang/test/CodeGen/builtins-elementwise-math.c -emit-llvm -disable-llvm-passes -o - | /path/to/llvm-project/build/bin/FileCheck /path/to/llvm-project/clang/test/CodeGen/builtins-elementwise-math.c
/path/to/llvm-project/clang/test/CodeGen/builtins-elementwise-math.c:16:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: call float @llvm.fabs.f32(float [[F1]])
                ^
<stdin>:35:43: note: scanning from here
 %0 = load float, float* %f1.addr, align 4
                                          ^
<stdin>:35:43: note: with "F1" equal to "%0"
 %0 = load float, float* %f1.addr, align 4
                                          ^
<stdin>:37:13: note: possible intended match here
 %elt.abs = call float @llvm.fabs.f32(float %1)
            ^
Dec 24 2021, 6:23 AM · Restricted Project
junaire added a comment to D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

Should also be used here?

Dec 24 2021, 2:02 AM · Restricted Project
junaire updated the diff for D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

Fix wrong usage.

Dec 24 2021, 12:12 AM · Restricted Project

Dec 22 2021

junaire updated the diff for D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

Update the existing place that can use emitUnaryBuiltin.

Dec 22 2021, 6:58 AM · Restricted Project
junaire updated the diff for D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

Update the existing place that can use emitUnaryBuiltin.

Dec 22 2021, 6:52 AM · Restricted Project
junaire added a comment to D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

Update the existing place that can use emitUnaryBuiltin.

I meant just update the existing uses *without* adding floor, roundeven, trunc, so this change should be NFC (non-functional change)

Dec 22 2021, 5:40 AM · Restricted Project
junaire updated the diff for D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

Sorry, It seems that the base branch is wrong, reupdate it.

Dec 22 2021, 5:39 AM · Restricted Project
junaire updated the diff for D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..

Update the existing place that can use emitUnaryBuiltin.

Dec 22 2021, 5:32 AM · Restricted Project
junaire added a comment to D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..

Sounds good! Might be good to split the emitUnaryBuiltin changes off into a separate change?

Dec 22 2021, 5:00 AM · Restricted Project
junaire requested review of D116161: [Clang] Extend emitUnaryBuiltin to avoid duplicate logic..
Dec 22 2021, 4:56 AM · Restricted Project

Dec 21 2021

junaire updated the diff for D115231: [Clang] Add __builtin_reduce_xor.
  • rebase to main.
  • rename PrepareBuiltinReduceMathOneArg to PrepareBuiltinReduceMathOneArgCall.
Dec 21 2021, 8:39 PM · Restricted Project

Dec 19 2021

junaire added a comment to D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..

Hi, @aaron.ballman I'm sorry for not updating the patch in time because I'm preparing for my school final exam :-(
One thing I want to mention is that __builtin_elementwise_roundeven is actually been added in the RFC during the code review. You can find it in D111529.

"Prevailing rounding mode" is not super-useful, other than as a spelling for round-to-nearest-ties-to-even (IEEE 754 default rounding). Outside of a FENV_ACCESS ON context, there's not even really a notion of "prevailing rounding mode" to appeal to. I assume the intent is for this to lower to e.g. x86 ROUND* with the dynamic rounding-mode immediate.

I would recommend adding __builtin_elementwise_roundeven(T x) instead, which would statically bind IEEE default rounding (following TS 18661-1 naming) without having to appeal to prevailing rounding mode, and can still lower to ROUND* on x86 outside of FENV_ACCESS ON contexts, which is the norm for vector code (and FRINTN unconditionally on armv8). I think we can punt on rint/nearbyint for now, and add them in the future if there's a need.

Dec 19 2021, 6:01 AM · Restricted Project
junaire updated the diff for D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..

Format the patch.

Dec 19 2021, 5:53 AM · Restricted Project
junaire updated the diff for D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..

Add a helper function to resue code. I'm not good at naming functions,
so I just oveloaded emitUnaryBuiltin.

Dec 19 2021, 5:51 AM · Restricted Project

Dec 17 2021

junaire updated the diff for D115936: [ASTMatcher] Add a new matcher called isInTopNamespace.

Format patch.

Dec 17 2021, 7:14 AM · Restricted Project
junaire added a reviewer for D115936: [ASTMatcher] Add a new matcher called isInTopNamespace: aaron.ballman.
Dec 17 2021, 6:17 AM · Restricted Project
junaire requested review of D115936: [ASTMatcher] Add a new matcher called isInTopNamespace.
Dec 17 2021, 6:03 AM · Restricted Project

Dec 16 2021

junaire added a comment to D115231: [Clang] Add __builtin_reduce_xor.

Thanks for accepting this patch! I would appreciate it if someone is willing to commit this for me since I don't have commit access ;D

Dec 16 2021, 2:32 AM · Restricted Project

Dec 15 2021

junaire updated the diff for D115231: [Clang] Add __builtin_reduce_xor.

Rename SemaBuiltinReduceMathPreCheck to PrepareBuiltinReduceMathOneArg

Dec 15 2021, 5:48 PM · Restricted Project
junaire updated the diff for D115231: [Clang] Add __builtin_reduce_xor.

Explicitly speak out types for Arg, but don't repeat the vector type name.

Dec 15 2021, 7:31 AM · Restricted Project
junaire added a comment to D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..

The RFC does not mention this builtin. It specifies __builtin_elementwise_rint and __builtin_elementwise_round. Is there a reason why this uses roundeven instead and should there be other rounding options provided at the same time?

Dec 15 2021, 6:19 AM · Restricted Project
junaire added a comment to D115231: [Clang] Add __builtin_reduce_xor.

Any reason not to handle builtin_reduce_xor + builtin_reduce_or as well in the same patch since they are very similar?

Dec 15 2021, 3:08 AM · Restricted Project
junaire added a comment to D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..

Ping.

Dec 15 2021, 1:38 AM · Restricted Project
junaire added a comment to D115231: [Clang] Add __builtin_reduce_xor.

Ping.

Dec 15 2021, 1:38 AM · Restricted Project

Dec 9 2021

junaire updated the diff for D115231: [Clang] Add __builtin_reduce_xor.

Fix wrong code logic.

Dec 9 2021, 6:46 AM · Restricted Project
junaire updated the diff for D115231: [Clang] Add __builtin_reduce_xor.

Improve diagnostic message.

Dec 9 2021, 12:16 AM · Restricted Project
junaire requested review of D115429: [Clang] Implement the rest of __builtin_elementwise_* functions..
Dec 9 2021, 12:05 AM · Restricted Project

Dec 8 2021

junaire updated the diff for D115231: [Clang] Add __builtin_reduce_xor.
  • Add extra type check to the vector elements.
  • Add comment about type restriction.
  • polish tests a little bit.
Dec 8 2021, 8:07 AM · Restricted Project

Dec 7 2021

junaire added a comment to D114688: [Clang] Add __builtin_elementwise_ceil.

I think it might be good to split off the refactoring of SemaBuiltinElementwiseMathOneArg-> PrepareBuiltinElementwiseMathOneArgCall and the update for BI__builtin_elementwise_abs into a separate, non functional change (NFC).

FWIW, I would not be opposed to that, but I don't insist either. LGTM!

Dec 7 2021, 3:59 PM · Restricted Project
junaire updated the diff for D114688: [Clang] Add __builtin_elementwise_ceil.

Fix typos

Dec 7 2021, 8:07 AM · Restricted Project
junaire added reviewers for D115231: [Clang] Add __builtin_reduce_xor: fhahn, aaron.ballman, scanon, craig.topper.
Dec 7 2021, 2:57 AM · Restricted Project
junaire requested review of D115231: [Clang] Add __builtin_reduce_xor.
Dec 7 2021, 2:56 AM · Restricted Project

Dec 3 2021

junaire updated the diff for D114688: [Clang] Add __builtin_elementwise_ceil.

No more lambdas

Dec 3 2021, 1:07 AM · Restricted Project

Dec 2 2021

junaire updated the diff for D114688: [Clang] Add __builtin_elementwise_ceil.

I didn't know if I understand Aaron's words right, but I think I can update the patch first...

Dec 2 2021, 6:56 AM · Restricted Project

Dec 1 2021

junaire updated the diff for D114688: [Clang] Add __builtin_elementwise_ceil.

Apply some awesome suggestions.

Dec 1 2021, 7:23 AM · Restricted Project

Nov 30 2021

junaire updated the diff for D114688: [Clang] Add __builtin_elementwise_ceil.

Adjust code style

Nov 30 2021, 10:47 PM · Restricted Project
junaire updated the diff for D114688: [Clang] Add __builtin_elementwise_ceil.

Reuse existing code.

Nov 30 2021, 10:35 PM · Restricted Project

Nov 28 2021

junaire requested review of D114688: [Clang] Add __builtin_elementwise_ceil.
Nov 28 2021, 10:25 PM · Restricted Project