## Status:
During the past weeks I have updated the restrict patches with various improvements:
- the ScopedNoAliasAA now also works together with the new pass manager
- the SLPVectorizer now works nice with the noalias support.
- there were some issues with some of the options enabling/disabling full restrict. These have been fixed.
- various smaller enhancements.
Today, I rebased the patches. [1]
Based on the feedback at the 'full restrict' roundtable, I also created a single patch containing all changes. [2]
## Request for testing and feedback:
Extra help with the code review would be great [1].
This includes feedback on the design decisions and naming.
It would also be great if you could just try it out and check the effect on your benchmarks and testcases.
The single patch[2] should make it more convenient to try it out:
- If the full restrict support triggers a problem, I would like to hear about it.
- But, if it works and improves your benchmarks, I also would like to hear about it, either through
phabricator, the llvm mailing list or in private.
## Known issues:
- For now, there is still no llvm-ir bitcode support for the load/store noalias_sidechannel argument.
- the 'SingleSource/Regression/C/gcc-c-torture/execute/GCC-C-execute-pr38212.test' in the 'test-suite' fails:
-- the test is wrong as it triggers undefined behavior: it reads and writes the same object through 2 different
restrict pointers which have been declared in the same scope.
## Future changes
- Another request that came up during the round table, is to split up the documentation in two parts:
a separate document describing the noalias architecture, and the LangRef, describing the intrinsics.
I'll be working on that in the coming days.
Thanks,
Jeroen Dobbelaere
[1] https://reviews.llvm.org/D68484 [PATCH 01/38] [noalias] LangRef: noalias intrinsics and noalias_sidechannel documentation.
[2] https://reviews.llvm.org/D69542 Full Restrict Support - single patch
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> On 29 Oct 2019, at 4:06 am, Finkel, Hal J. via llvm-dev <llvm...@lists.llvm.org> wrote:
>
> On 10/28/19 8:12 PM, Jeroen Dobbelaere via llvm-dev wrote:
>>
>> - the 'SingleSource/Regression/C/gcc-c-torture/execute/GCC-C-execute-pr38212.test' in the 'test-suite' fails:
>> -- the test is wrong as it triggers undefined behavior: it reads and writes the same object through 2 different
>> restrict pointers which have been declared in the same scope.
>
>
> This, we can fix now independent of anything else. We should either fix
> the test, if there's a reasonable way to fix it, or we should remove it.
> If you can post a patch with an explanation of the problem, that would
> be great.
I’m wary of updating the test itself, as someone may re-vendor the GCC C torture suite, undoing those edits. However, we already exclude some tests in the GCC torture suite because they rely on UB. Having inspected pr38212.c, I am happy to add this test to the list of excluded tests with the explanation provided. I’ll commit that change today.
Sam
--
Sam Elliott
Software Developer - LLVM
lowRISC CIC
--
> - the 'SingleSource/Regression/C/gcc-c-torture/execute/GCC-C-execute-pr38212.test' in the 'test-suite' fails:
> -- the test is wrong as it triggers undefined behavior: it reads and writes the same object through 2 different
> restrict pointers which have been declared in the same scope.
What's the failure mode? Wrong answers or compiler abort? If the
latter, it would be nice if LLVM could emit a warning about illegal use
of restrict. Longer term, a RestrictSanitizer would be really helpful.
-David
> it would be nice if LLVM could emit a warning about illegal use
> of restrict. Longer term, a RestrictSanitizer would be really helpful.
Yes :)
I would think it would not require any runtime (think - asan/msan) support,
so i'm not sure why it could not be a part of UBSan proper.
In other words i'd like to *tentatively* claim this,
i may be interested to look into it, after the restrict support lands :)
> -David
Roman
> -----Original Message-----
> From: David Greene <gre...@obbligato.org>
[...]
> What's the failure mode? Wrong answers or compiler abort? If the
> latter, it would be nice if LLVM could emit a warning about illegal use
> of restrict. Longer term, a RestrictSanitizer would be really helpful.
>
> -David
The compiler produces code that does not do what the testcase expects it to do.
This particular case could be detected and warned for at compile time (after inlining and constant propagation).
Greetings,
Jeroen
Hi Alexey,
Adding llvm-ir bitcode support means adding/adapting the tags for LOAD/STORE instructions and adding
the support for the noalias_sidechannel at the right places.
I had a short attempt to implement it when preparing the public patches, but I am not familiar with that
part of the llvm code. When I noticed that it would take a lot longer than anticipated, I postponed it.
Also because it is likely that the way how the noalias_sidechannel was added to LoadInst/StoreInst might
change.
At this moment, I am not planning to work on this. For the current implementation, there might be
a number of possibilities for adding support :
- maybe 2 new tags are needed (FUNC_CODE_INST_{LOAD_NOALIAS,STORE_NOALIAS})
- or maybe it is sufficient to add the noalias_sidechannels as extra operands and look at the number of
operands to see if they are present or not
- or maybe it is sufficient to look at the number of operands, and the noalias_sidechannel operand should
be added with an extra bit, indicating if it is really there or not...
Greetings,
Jeroen Dobbelaere
From: Alexey Zhikhartsev <alexey....@gmail.com>
Sent: Thursday, October 31, 2019 16:21
To: Jeroen Dobbelaere <dob...@synopsys.com>
Cc: llvm...@lists.llvm.org
Subject: Re: [llvm-dev] Full restrict support - status update
Hi Jeroen,
Thank you very much for the great work, it is much appreciated.
> - For now, there is still no llvm-ir bitcode support for the load/store noalias_sidechannel argument.
Do you have plans to work on this in the near future? Do you know how much work it is and if there are significant hurdles?
Thanks,
Alexey
[...]
Hi Hal,
Thanks very much for scheduling the LLVM Alias Analysis Technical Call. I have added more details to the Google document.
Regards,
Tarique Islam
XL Fortran Compiler Development
IBM Toronto Software Lab
tis...@ca.ibm.com (905) 413-3190
"Finkel, Hal J. via llvm-dev" ---2020-05-18 12:41:56 PM---To join our call on Thursday, May 28th @ 9-10 AM central time / 2-3 PM UTC please use this informati
Hi Hal,
If it is okay with the group, we can start looking into the LLVM codebase for Metadata operations and discuss about the technical details related to the scalability. In that case, we can start with the following.
./llvm/include/llvm/IR/Metadata.h
./llvm/lib/IR/Metadata.cpp
./llvm/lib/Analysis/ScopedNoAliasAA.cpp
If needed, we can present some slides for a quick recap of the alias representation.
Regarding the hierarchical representation, we can start with your patch for scoped-noalias metadata.
https://github.com/llvm/llvm-project/commit/9414665a3b0bd525f84d76e24048ca60ebe6c710
Regards,
Tarique Islam
XL Fortran Compiler Development
IBM Toronto Software Lab
tis...@ca.ibm.com (905) 413-3190
"Finkel, Hal J." ---2020-05-21 12:15:42 PM---Great, thanks! Are you planning on just talking about these things with slides? Do we have other thi
Two additional references for the discussion.
1. (IBM) Represent Fortran alias information in LLVM IR - http://lists.llvm.org/pipermail/llvm-dev/2020-April/140945.html
2. (Jeroen et al.) RFC: Full 'restrict' support in LLVM - https://lists.llvm.org/pipermail/llvm-dev/2019-October/135672.html
Regards,
Tarique Islam
XL Fortran Compiler Development
IBM Toronto Software Lab
tis...@ca.ibm.com (905) 413-3190
Tarique Islam via llvm-dev ---2020-05-25 08:34:18 PM---Hi Hal, If it is okay with the group, we can start looking into the LLVM codebase
Scalability challenges and other issues discovered with the current infrastructure (especially, perhaps, with the noalias metadata).
Issue #1: MDNode::intersect uses O(n^2) algorithm. The operation does not scale for large NoAlias sets.
Issue #2: ScopedNoAliasAAResult::mayAliasInScopes includes overhead (per query) of partitioning the input set based on the domain metadata.
Issue #3: Memory footprint of the flattened Alias.Scope or NoAlias set can be large.
Issue #4: correctness: current implementation has problems after inlining in a loop.
Proposed solutions: progress, outstanding challenges, how to make progress going forward.
Proposal #1: (Related to both Issue #1 and Issue #2) In the MDNode class, pre-partition the set of Metadata operands where each partition is an ordered set of Metadata operands belonging
to a specific domain.
Proposal #2: (Related to Issue #3) Design a hierarchical representation for the metadata operands in Alias.Scope and NoAlias sets.
Proposal #3: https://reviews.llvm.org/D68484 provides the infrastructure to fix issue #4. It might also help with issue #1 and issue #3 as it makes it possible to share scopes.
-Hal
Scalability challenges and other issues discovered with the current infrastructure (especially, perhaps, with the noalias metadata).
Issue #1: MDNode::intersect uses O(n^2) algorithm. The operation does not scale for large NoAlias sets.
Issue #2: ScopedNoAliasAAResult::mayAliasInScopes includes overhead (per query) of partitioning the input set based on the domain metadata.
Issue #3: Memory footprint of the flattened Alias.Scope or NoAlias set can be large.
Issue #4: correctness: current implementation has problems after inlining in a loop.
Notes:
Jeroen notes that he has not observed scalability issues with the
“full restrict” implementation.
Michael notes that part of the scalability challenge comes from the fact that the noalias scheme marks all those things with which you don’t alias, but for restrict-like pointers, that’s the default for everything in that scope.
Tarique notes that there may still be a need for AA from the frontend, e.g., for Fortran, above what the C-like restrict provides.
Eric asks if anyone is considering a ground-up design to support Fortran?
Troy notes that we would prefer one representation to cover Fortran, C, etc. Fortran is, in some sense, simpler than C/C++. Also notes that language-specific AA can be a useful technique as well.
Johannes notes that other languages, e.g., Rust, can also benefit, and we might need something where we can have universes, negated aliasing edges, etc.
Michael notes that we can chain AA, and so it’s possible to have something more domain specific.
Hal notes that if we have language-specific MD, we need to figure out how to maintain it (otherwise, all of the passes will drop it, but maintaining it means that enough of the semantics must be available). Jeroen notes that reusing in-tree passes maximally reuses correct implementation in combination with loop unrolling, etc.
Proposed solutions: progress, outstanding challenges, how to make progress going forward.
Proposal #1: (Related to both Issue #1 and Issue #2) In the MDNode class, pre-partition the set of Metadata operands where each partition is an ordered set of Metadata operands belonging to a specific domain.
Proposal #2: (Related to Issue #3) Design a hierarchical representation for the metadata operands in Alias.Scope and NoAlias sets.
Proposal #3:
https://reviews.llvm.org/D68484 provides the infrastructure to fix issue #4. It might also help with issue
#1 and issue #3 as it makes it possible to share scopes.
Notes
Tarique presented challenges with the current prototype, including that there’s currently no way to differentiate noalias MD from other kinds of metadata, so it’s hard to keep a useful cache in the generic MDNode implementation.
Jeroen presented some slides on the full-restrict implementation, noted how this scheme might solve/mitigate some of the scalability challenges associated with the pure-metadata solution.
The full-restrict implementation is being used, and Jerone is currently updating this implementation based on feedback from that usage, he also will update the implementation to use provenance instead of sidechannel and repost.
Johannes notes that we need more reviewers for this patch set.
Thanks, everyone. It looks like we do have a time that works for almost everyone.
Let's plan to meet on Tuesday, July 14th @ 12-1 central time / 10-11 pacific time / 6-7pm in London, and at that time on Tuesday every four weeks.
Please use the Google doc linked below to add agenda items for the next call (or, if you cannot access a Google doc, send me a note and I'll add them for you).
https://docs.google.com/document/d/1ybwEKDVtIbhIhK50qYtwKsL50K-NvB6LfuBsfepBZ9Y/edit?usp=sharing
Meeting URL
https://bluejeans.com/101176001?src=join_info
Meeting ID
101 176 001
Want to dial in from a phone?
Dial one of the following numbers:
+1.312.216.0325 (US (Chicago))
+1.408.740.7256 (US (San Jose))
+1.866.226.4650 (US Toll Free)
(see all numbers - https://www.bluejeans.com/premium-numbers)
Enter the meeting ID and passcode followed by #
Connecting from a room system?
Dial: bjn.vc or 199.48.152.152 and enter your meeting ID &
passcode
Thanks again,
Hal
-- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory
Agenda
Full restrict patch
Observation and clarification
Issues encountered
Speed up in intersection code - O(nlog(n))
Calling Verifier after LoopVectorize pass?
Thanks, everyone. It looks like we do have a time that works for almost everyone.
Let's plan to meet on Tuesday, July 14th @ 12-1 central time / 10-11 pacific time / 6-7pm in London, and at that time on Tuesday every four weeks.
Please use the Google doc linked below to add agenda items for the next call (or, if you cannot access a Google doc, send me a note and I'll add them for you).
https://docs.google.com/document/d/1ybwEKDVtIbhIhK50qYtwKsL50K-NvB6LfuBsfepBZ9Y/edit?usp=sharing
Meeting URL
https://bluejeans.com/101176001?src=join_info
Meeting ID
101 176 001
Want to dial in from a phone?
Dial one of the following numbers:
+1.312.216.0325 (US (Chicago))
+1.408.740.7256 (US (San Jose))
+1.866.226.4650 (US Toll Free)
(see all numbers -
https://www.bluejeans.com/premium-numbers)
Enter the meeting ID and passcode followed by #
Connecting from a room system?
Dial: bjn.vc or 199.48.152.152 and enter your meeting ID & passcode
Thanks again,
Hal
Agenda
[Tarique] Discussion on Jeroen’s idea on “Using full restrict to map sets of variables to a universe” in the context of Fortran aliasing.
[Jeroen] Discussion on what is missing/needed to go forward
Any feedback on the base infrastructure ?
Llvm-ir bitcode support
Recent rebase
Review plan
To supplement my reminder below, the notes document and call-in information are:
https://docs.google.com/document/d/1ybwEKDVtIbhIhK50qYtwKsL50K-NvB6LfuBsfepBZ9Y/edit?usp=sharing
Meeting URL
https://bluejeans.com/101176001?src=join_info
Meeting ID
101 176 001
Want to dial in from a phone?
Dial one of the following numbers:
+1.312.216.0325 (US (Chicago))
+1.408.740.7256 (US (San Jose))
+1.866.226.4650 (US Toll Free)
(see all numbers -
https://www.bluejeans.com/premium-numbers)
Enter the meeting ID and passcode followed by #
Connecting from a room system?
Dial: bjn.vc or 199.48.152.152 and enter your meeting ID &
passcode
Thanks again,
Hal
_______________________________________________ LLVM Developers mailing list llvm...@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
[Jeroen] Status of the Full Restrict Patches:
Llvm-ir bitcode support has been added
Rebased (to September 7, 2020) and updated patches have been published
I did not get any objections on my request about the high level approach
Proposal: start actively reviewing the changes, starting with the first 5 or 6 patches
the notes document and call-in information are:
https://docs.google.com/document/d/1ybwEKDVtIbhIhK50qYtwKsL50K-NvB6LfuBsfepBZ9Y/edit?usp=sharing
Meeting URL
https://bluejeans.com/101176001?src=join_info
Meeting ID
101 176 001
Want to dial in from a phone?
Dial one of the following numbers:
+1.312.216.0325 (US (Chicago))
+1.408.740.7256 (US (San Jose))
+1.866.226.4650 (US Toll Free)
(see all numbers - https://www.bluejeans.com/premium-numbers)
Enter the meeting ID and passcode followed by #
Connecting from a room system?
Dial: bjn.vc or 199.48.152.152 and enter your meeting ID & passcode