Skip to content

Ml intrinsics #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 557 commits into from
Closed

Ml intrinsics #299

wants to merge 557 commits into from

Conversation

mleair
Copy link
Contributor

@mleair mleair commented Mar 24, 2021

@jeanPerier @schweitzpgi
Please review these changes for the SCAN intrinsic. I was not sure about the TBD portions for handling optional arguments. The routine genScan() in IntrinsicCall.cpp has a couple TBD comments for optional arguments.

schweitzpgi and others added 30 commits March 1, 2021 13:54
Also rename instantiateLocalAlias to instantiateAlias and use it
in global (the global code was also wrong not to use
mapSymbolAndAttributes).
extend syntax for fir.iterate_while as well.
extend builder methods.
Addition of the AArch64 target will enable lowering on this platform.
All tests can also be run with this change.
This is a legacy function, it was kept to protect from array character in
context that are not array ready. It fired in createUnboxChar where it is
OK to get arrays. Remove it and enforce the arrays bans on caller sides
where it make sens.
Add the ability to test if a subprogram is recursive or not.
… longer needed. Update test to reflect the simpler fir that is now generated.
Handle assumed shape array both on callee/caller sides:

- Modify the call interface lowering utility to handle explicit interface,
  add TODOs for anything but intrinsic type assumed shape arrays.

- On caller side, simply add a call to createBox in case the interface needs
  a box.

- On callee side, the lowering of bounds is done using `fir.box_dims`, the
  address is obtained with `fir.box_addr` and for character the length is
  done using `fir.box_elesize`.

Note that fir generation works as expected, but lowering to LLVM on the callee
side fails due to a bad GEP generated for fir.box_dims.

Assumed shape array do not require any change in the symbol map used in lowering
because their shape and base address cannot change in the program unit (as
opposed to allocatable/pointers that are deferred shape arrays).
- Always reflect rank when lowering fir.box type to its llvm
type (make the dimension array explicit). This is needed to
use the LLVM GEP when lowering fir.box_dims on callee side.

- Fix my own incompetence of getting bad indexes for lower_bound
and extent (1 and 2 instead of 0 and 1).

- The front-end is not making implicit assumed shape lower bounds
explicit (to 1) but is labeling as deferred. Due to this, the
code was taking the lower bound of the descriptor instead of
of 1. Workaround this for now, when we lower allocatable and
pointer, we will want either to update the front-end to make assumed
shape lower bound explicit or to handle this better in lowering.

- Align lit tests

With this patch, assumed shape associated with contiguous intrinsic
variable are compiling OK end to end.
* Add END statements to the PFT - Fix #503 and #524

Program unit end statements may have labels that may be branch targets.
Modify the PFT to include these statements.  Update the PFT dump to
insert a blank in PFT annotations, so 'EndSubroutineStmt', which is
an actual PFT node, is somewhat differentiated from 'End Subroutine',
which is not.

There is an additional front end bug that when addressed will fix
additional instances of #524.
…ss result

- This was a left over TODO from character refactoring, scalar character base
address type fir.ref<fir.char> should not be propagated anymore since
character related utilities are expecting a sequence type with the length
as first dimension.
This prevented unformatted IO with scalar characters to lower.

- Lower character length directly in translateSymbolToFIRType

- Remove genTypeWithCharFixup now translateSymbolToFIRType handles this
schweitzpgi and others added 25 commits March 16, 2021 10:47
Also make AbstractIrBox inherit from AbstractArrayBox to get the array
aspects from there.
[NFC] Remove old BoxValue class and rename IrBoxValue to BoxValue
[flang] Fixing shared library builds
This handles the lowering of the basic cases. There are several TODOs in
the code for other variants.

This lowers expressions like the following where a and b are arrays.

  a = f(b)
  a = abs(b)

These are transformed into loop (nests) where the right-hand side is
fully evaluated by applying the function to each element in the array
and then the resulting array is copied-out to the left-hand side.
[flang] Removing extraneous semi-colon, gcc 9.3.0 is complaining about
The linker on macos doesn't accept `-rpath=...`, it wants the library
as a separate argument. That seems to work okay on linux too.
Also replace `%temp` with `%t` where that was intended.
Add the capability to lower select case constructs of any type to
either FIR SelectCaseOp's or a sequence of comparisons and branches.
Actually generate SelectCaseOp's for integer type constructs, but use
comparisons and branches for logical types (the code is better) and
for character types (it isn't possible yet to handle character
SelectCaseOp's downstream).
Lowering of basic elemental functions (intrinsic and user-defined).
[flang] Adding ability to customize the printer of the LLVMIRLoweringPass
@repo-lockdown
Copy link

repo-lockdown bot commented Mar 24, 2021

This repository does not accept pull requests. Please follow http://llvm.org/docs/Contributing.html#how-to-submit-a-patch for contribution to LLVM.

@repo-lockdown repo-lockdown bot closed this Mar 24, 2021
@repo-lockdown repo-lockdown bot locked and limited conversation to collaborators Mar 24, 2021
@mleair mleair deleted the ml-intrinsics branch March 30, 2021 19:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.