Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

TIFitis (Akash Banerjee)
Compiler Engineer

Projects

User does not belong to any projects.

User Details

User Since
Aug 16 2022, 6:02 AM (57 w, 3 d)

Compiler Engineer @AMD UK.

Recent Activity

Mon, Sep 18

TIFitis accepted D158732: [OpenMP][MLIR] Refactor and extend current map support by adding MapInfoOp and DataBoundsOp operations to the OpenMP Dialect.
Mon, Sep 18, 5:21 AM · Restricted Project, Restricted Project
TIFitis accepted D158734: [Flang][OpenMP] Add lowering from PFT to new MapEntry and Bounds operations and tie them to relevant Target operations.
Mon, Sep 18, 5:20 AM · Restricted Project, Restricted Project
TIFitis accepted D158735: [Flang][MLIR][OpenMP] Update OMPEarlyOutlining to support Bounds, MapEntry and declare target globals.
Mon, Sep 18, 5:17 AM · Restricted Project, Restricted Project
TIFitis accepted D158737: [MLIR][OpenMP] Alterations to LLVM-IR lowering of OpenMP Dialect due to Bounds and MapEntry operations.

LGTM :)

Mon, Sep 18, 5:15 AM · Restricted Project, Restricted Project

Wed, Sep 13

TIFitis added inline comments to D158737: [MLIR][OpenMP] Alterations to LLVM-IR lowering of OpenMP Dialect due to Bounds and MapEntry operations.
Wed, Sep 13, 5:47 AM · Restricted Project, Restricted Project

Tue, Sep 12

TIFitis added inline comments to D158737: [MLIR][OpenMP] Alterations to LLVM-IR lowering of OpenMP Dialect due to Bounds and MapEntry operations.
Tue, Sep 12, 11:06 AM · Restricted Project, Restricted Project
TIFitis added inline comments to D158737: [MLIR][OpenMP] Alterations to LLVM-IR lowering of OpenMP Dialect due to Bounds and MapEntry operations.
Tue, Sep 12, 7:28 AM · Restricted Project, Restricted Project

Aug 16 2023

TIFitis committed rG5d9ccd7a9693: [OpenMP] Migrate dispatch related utility functions from Clang codegen to… (authored by TIFitis).
[OpenMP] Migrate dispatch related utility functions from Clang codegen to…
Aug 16 2023, 8:36 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis closed D157994: [OpenMP] Migrate dispatch related utility functions from Clang codegen to OMPIRBuilder.
Aug 16 2023, 8:35 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D157994: [OpenMP] Migrate dispatch related utility functions from Clang codegen to OMPIRBuilder.

Updated test with correct function attributes.

Aug 16 2023, 6:36 AM · Restricted Project, Restricted Project, Restricted Project

Aug 15 2023

TIFitis added inline comments to D157994: [OpenMP] Migrate dispatch related utility functions from Clang codegen to OMPIRBuilder.
Aug 15 2023, 9:40 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis requested review of D157994: [OpenMP] Migrate dispatch related utility functions from Clang codegen to OMPIRBuilder.
Aug 15 2023, 9:34 AM · Restricted Project, Restricted Project, Restricted Project

Aug 14 2023

TIFitis accepted D155633: [OpenMP][OpenMPIRBuilder] Add kernel launch codegen to emitTargetCall.

LGTM

Aug 14 2023, 7:07 AM · Restricted Project, Restricted Project, Restricted Project

Aug 11 2023

TIFitis added inline comments to D155633: [OpenMP][OpenMPIRBuilder] Add kernel launch codegen to emitTargetCall.
Aug 11 2023, 6:35 AM · Restricted Project, Restricted Project, Restricted Project

Aug 9 2023

TIFitis added inline comments to D155633: [OpenMP][OpenMPIRBuilder] Add kernel launch codegen to emitTargetCall.
Aug 9 2023, 8:31 AM · Restricted Project, Restricted Project, Restricted Project

Aug 4 2023

TIFitis committed rG1e92e25cb4a9: [MLIR][OpenMP] Added MLIR translation support for use_device clauses (authored by TIFitis).
[MLIR][OpenMP] Added MLIR translation support for use_device clauses
Aug 4 2023, 7:39 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis closed D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.
Aug 4 2023, 7:39 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Aug 3 2023

TIFitis updated the summary of D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.
Aug 3 2023, 3:36 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis added a comment to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

use_device_ptr: The mapped variables marked with use_device_ptr are accessed through new pointer allocas inside the region.
use_device_addr: The mapped variables marked with use_device_addr are accessed through the base pointer mappers.

This explanation in the summary talks of mapped variables. Mapping is always not necessary. Could you also expand the explanation a little more? And also talk a bit about the difference between use_device_ptr and use_device_addr.

Aug 3 2023, 3:31 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Aug 2 2023

TIFitis added a comment to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Ping for review :)

Aug 2 2023, 2:52 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jul 27 2023

TIFitis accepted D155981: [Flang][OpenMP][Lower] Refactor implementation of PFT to MLIR lowering.
Jul 27 2023, 3:46 AM · Restricted Project, Restricted Project
TIFitis added a comment to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

BTW I am not sure how to resolve the windows build error that I am getting repeatedly. It's giving an unknown identifier error for the fail functor being called at OpenMPToLLVMIRTranslation.cpp:1429. Any insight would be much appreciated.

Might be a bug in the compiler in windows. You are trying to call a lambda function inside a lambda function here. Try moving the second lambda into a static function or try capturing the second lambda explicitly in the first lambda.

Jul 27 2023, 3:22 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jul 26 2023

TIFitis accepted D156170: [MLIR][OpenMP] Allow map operands to be not specified.

LGTM :)

Jul 26 2023, 5:36 AM · Restricted Project, Restricted Project, Restricted Project

Jul 25 2023

TIFitis updated the diff for D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Addressed reviewer comments. Try to fix build error.

Jul 25 2023, 5:13 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jul 24 2023

TIFitis added a comment to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

BTW I am not sure how to resolve the windows build error that I am getting repeatedly. It's giving an unknown identifier error for the fail functor being called at OpenMPToLLVMIRTranslation.cpp:1429. Any insight would be much appreciated.

Jul 24 2023, 9:47 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis added a comment to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

While looking into this patch, I noticed that the current implementation in Semantics and MLIR requires the MAP clause to always be present. But the standard only says the following,

At least one map, use_device_addr or use_device_ptr clause must appear on the directive.

I will fix this. But this made having a look at the code generated only with use_device_addr, use_device_ptr and without map difficult.

Jul 24 2023, 6:32 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Addressed reviewer comments. Added missing LoadInst for use_device_addr inside region block.

Jul 24 2023, 6:27 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Attempt at fixing build error

Jul 24 2023, 3:31 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jul 21 2023

TIFitis added inline comments to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.
Jul 21 2023, 6:20 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Renamed failure() to fail()

Jul 21 2023, 6:18 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jul 19 2023

TIFitis added inline comments to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.
Jul 19 2023, 4:58 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Rebased. Addressed reviewer comments. Fixed bug in generating map info for device_addr - device info type was incorrectly being set to pointer.

Jul 19 2023, 4:54 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jul 17 2023

TIFitis accepted D128162: [flang][OpenMP] Added atomic update assignment statement related semantic checks.

LGTM.

Jul 17 2023, 9:12 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis accepted D127620: [flang][OpenMP] Added semantic checks for atomic capture, write, and update statements.

Please allow for another +1.

Jul 17 2023, 9:09 AM · Restricted Project, Restricted Project
TIFitis added a comment to D123011: [flang][OpenMP] Fixed symbol details type for critical construct names.

@NimishMishra Can you please address the previous comments. I'd be happy to review it further.

Jul 17 2023, 9:08 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added a comment to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Ping for review

Jul 17 2023, 5:15 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jul 12 2023

TIFitis added a comment to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Here is an example of what clang generates:

Jul 12 2023, 4:33 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the summary of D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.
Jul 12 2023, 4:23 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis added a comment to D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Ping for review :)

Jul 12 2023, 4:07 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis committed rG227012cbd71f: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder (authored by TIFitis).
[OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder
Jul 12 2023, 4:04 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis closed D152554: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder.
Jul 12 2023, 4:03 AM · Restricted Project, Restricted Project, Restricted Project

Jul 10 2023

TIFitis added a comment to D152554: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder.

Ping for review :)

Jul 10 2023, 5:56 AM · Restricted Project, Restricted Project, Restricted Project

Jul 6 2023

TIFitis updated the diff for D152554: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder.

Rebased

Jul 6 2023, 5:53 AM · Restricted Project, Restricted Project, Restricted Project

Jul 5 2023

TIFitis committed rG07630da36a31: Minor change to clang test (authored by TIFitis).
Minor change to clang test
Jul 5 2023, 6:59 AM · Restricted Project, Restricted Project
TIFitis committed rG4a49226537ab: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder (authored by TIFitis).
[OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder
Jul 5 2023, 6:04 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jul 4 2023

TIFitis accepted D154442: [Flang][OpenMP] Only access the MapType if it is specified.
Jul 4 2023, 6:53 AM · Restricted Project, Restricted Project

Jun 30 2023

TIFitis committed rGa5ea67606747: Reverting commit 0d8d718171192301f2beb10bd08ce62e70281a5e as it broke… (authored by TIFitis).
Reverting commit 0d8d718171192301f2beb10bd08ce62e70281a5e as it broke…
Jun 30 2023, 8:05 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis committed rG0d8d71817119: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder (authored by TIFitis).
[OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder
Jun 30 2023, 7:13 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis closed D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.
Jun 30 2023, 7:12 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis retitled D152554: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder from [OpenMP] Migrate deviice code privatization from Clang CodeGen to OMPIRBuilder to [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder.
Jun 30 2023, 7:00 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added inline comments to D152554: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder.
Jun 30 2023, 7:00 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D152554: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder.

Addressed reviewer comments.

Jun 30 2023, 6:59 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.

Rebased to fix build error.

Jun 30 2023, 6:49 AM · Restricted Project, Restricted Project, Restricted Project

Jun 28 2023

TIFitis added inline comments to D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.
Jun 28 2023, 10:07 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.

Addressed reviewer comments

Jun 28 2023, 10:07 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added a reviewer for D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder: arsenm.
Jun 28 2023, 9:21 AM · Restricted Project, Restricted Project, Restricted Project

Jun 27 2023

TIFitis retitled D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses from [MLIR][OpenMP] Added OMPIRBuilder support for use_device_ptr clause to [MLIR][OpenMP] Added MLIR translation support for use_device clauses.
Jun 27 2023, 10:00 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D146648: [MLIR][OpenMP] Added MLIR translation support for use_device clauses.

Made changes to use updated OMPIRBuilder

Jun 27 2023, 9:58 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jun 26 2023

TIFitis added a comment to D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.

Gentle ping :)

Jun 26 2023, 5:22 AM · Restricted Project, Restricted Project, Restricted Project

Jun 22 2023

TIFitis updated the diff for D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.

Moved device clause emition after if clause.

Jun 22 2023, 8:09 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis committed rGd21580c30657: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses (authored by TIFitis).
[MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses
Jun 22 2023, 7:53 AM · Restricted Project, Restricted Project
TIFitis committed rG0657ae30c77d: [MLIR][OpenMP] Minor change to assembly format for Target Data op (authored by TIFitis).
[MLIR][OpenMP] Minor change to assembly format for Target Data op
Jun 22 2023, 7:53 AM · Restricted Project, Restricted Project
TIFitis closed D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.
Jun 22 2023, 7:52 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis closed D152822: [MLIR][OpenMP] Minor change to assembly format for Target Data op.
Jun 22 2023, 7:52 AM · Restricted Project, Restricted Project
TIFitis added inline comments to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.
Jun 22 2023, 4:43 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

Addressed reviewer comments.

Jun 22 2023, 4:43 AM · Restricted Project, Restricted Project, Restricted Project

Jun 21 2023

TIFitis added inline comments to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.
Jun 21 2023, 1:40 PM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

Addressed reviewer comments

Jun 21 2023, 1:38 PM · Restricted Project, Restricted Project, Restricted Project
TIFitis added inline comments to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.
Jun 21 2023, 9:02 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

Fixed support for pointer type.

Jun 21 2023, 9:00 AM · Restricted Project, Restricted Project, Restricted Project

Jun 20 2023

TIFitis added a comment to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

@kiranchandramohan Thanks a lot for helping me with the pseudocode.

Jun 20 2023, 7:38 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

Added block arguments.

Jun 20 2023, 7:30 AM · Restricted Project, Restricted Project, Restricted Project

Jun 19 2023

TIFitis added a comment to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

I've updated the patch. I am not sure if this is the correct way of adding the block arguments.

Jun 19 2023, 10:51 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

[WIP] Add block arguments.

Jun 19 2023, 10:33 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added inline comments to D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.
Jun 19 2023, 9:25 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added a comment to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

My current implementation generates the following FIR.

Fortran:

subroutine omp_target_data
    integer :: a
    a = 10
    !$omp target data map(tofrom: a) use_device_ptr(a)
        a = 20
    !$omp end target data
    a = 30
end subroutine omp_target_data

FIR:

func.func @_QPomp_target_data() {
  %0 = fir.alloca i32 {bindc_name = "a", uniq_name = "_QFomp_target_dataEa"}
  %c10_i32 = arith.constant 10 : i32
  fir.store %c10_i32 to %0 : !fir.ref<i32>
  %1 = fir.alloca i32 {bindc_name = "a", pinned, uniq_name = "_QFomp_target_dataEa"}
  omp.target_data   map((tofrom -> %0 : !fir.ref<i32>))   use_device_ptr((%1 -> %0 : !fir.ref<i32>)) {
    %c20_i32 = arith.constant 20 : i32
    fir.store %c20_i32 to %1 : !fir.ref<i32>
    omp.terminator
  }
  %c30_i32 = arith.constant 30 : i32
  fir.store %c30_i32 to %0 : !fir.ref<i32>
  return
}

Is the above code more or less what you are expecting?

No. What I was thinking was something like the following.

func.func @_QPomp_target_data() {
  %0 = fir.alloca i32 {bindc_name = "a", uniq_name = "_QFomp_target_dataEa"}
  %c10_i32 = arith.constant 10 : i32
  fir.store %c10_i32 to %0 : !fir.ref<i32>
  omp.target_data   map((tofrom -> %0 : !fir.ref<i32>))   use_device_ptr((%1 -> %0 : !fir.ref<i32>)) {
  ^bb0(%1: !fir.ref<i32>):
    %c20_i32 = arith.constant 20 : i32
    fir.store %c20_i32 to %1 : !fir.ref<i32>
    omp.terminator
  }
  %c30_i32 = arith.constant 30 : i32
  fir.store %c30_i32 to %0 : !fir.ref<i32>
  return
}

However, since MLIR would also be creating private versions for us now, we would have to add in code in the IRBuilder to treat clang and mlir separately which I'd like to avoid as much as possible.

MLIR will not be creating a private version. It will only be providing a block argument that you can use to lower easily to the private version created by the IRBuilder. (I believe, you previously reported that it was easy to use block arguments to lower to LLVM IR.)

Jun 19 2023, 8:23 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added a comment to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

Also, my initial plan was to have OMPIRBuilder entirely handle codegen for both clang and mlir.

Jun 19 2023, 7:21 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added a comment to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

My current implementation generates the following FIR.

Jun 19 2023, 7:13 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis committed rGa032dc139dda: [MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder (authored by TIFitis).
[MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder
Jun 19 2023, 5:10 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis closed D146557: [MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder.
Jun 19 2023, 5:09 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Jun 16 2023

TIFitis added a comment to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

Thinking of this again, we might not need a change in the operands for use_device_ptr or use_device_addr since we are only adding block arguments.

Jun 16 2023, 3:12 AM · Restricted Project, Restricted Project, Restricted Project

Jun 15 2023

TIFitis updated the diff for D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.

Rebased

Jun 15 2023, 8:14 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added inline comments to D146557: [MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder.
Jun 15 2023, 8:11 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D146557: [MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder.

Addressed reviewer comments

Jun 15 2023, 8:11 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis added a comment to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

Weren't you planning to make the device_ptr a block argument operand?

I made that change when lowering to llvm IR in mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
Here's a snippet of code showing how I did it. If there's a better way of doing this I'd be happy to know.

for (auto &devPtrOp : useDevPtrOperands) {
  llvm::Value *mapOpValue = moduleTranslation.lookupValue(devPtrOp);
  const auto &arg =
      region.addArgument(devPtrOp.getType(), devPtrOp.getLoc());
  moduleTranslation.mapValue(arg,
                             info.DevicePtrInfoMap[mapOpValue].second);
  replaceAllUsesInRegionWith(devPtrOp, arg, region);
}

Weren't you planning to make the device_ptr a block argument operand?

I made that change when lowering to llvm IR in mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
Here's a snippet of code showing how I did it. If there's a better way of doing this I'd be happy to know.

for (auto &devPtrOp : useDevPtrOperands) {
  llvm::Value *mapOpValue = moduleTranslation.lookupValue(devPtrOp);
  const auto &arg =
      region.addArgument(devPtrOp.getType(), devPtrOp.getLoc());
  moduleTranslation.mapValue(arg,
                             info.DevicePtrInfoMap[mapOpValue].second);
  replaceAllUsesInRegionWith(devPtrOp, arg, region);
}

The modelling for the Operation (target data) should be changed to represent both use_device_addr and use_device_addr as a block argument.
May be something like omp.target_data use_device_addr(%daddr -> %a), where %daddr is an entry block argument and %daddr will be used inside the region and not %a.
Note that this might require a custom printer and parser.
This will be a more accurate modelling since the standard explicitly says that the address will be a device address (and not the host address) and hence it is incorrect to use the host address in the body of the region.

The device_addr example from your test will look like the following.

func.func @_QPomp_target_device_addr() {
  %0 = fir.alloca !fir.box<!fir.ptr<i32>> {bindc_name = "a", uniq_name = "_QFomp_target_device_addrEa"}
  %1 = fir.zero_bits !fir.ptr<i32>
  %2 = fir.embox %1 : (!fir.ptr<i32>) -> !fir.box<!fir.ptr<i32>>
  fir.store %2 to %0 : !fir.ref<!fir.box<!fir.ptr<i32>>>
  omp.target_data   map((tofrom -> %0 : !fir.ref<!fir.box<!fir.ptr<i32>>>))   use_device_addr(%daddr -> %0 : !fir.ref<!fir.box<!fir.ptr<i32>>>) {
    %c10_i32 = arith.constant 10 : i32
    %3 = fir.load %daddr : !fir.ref<!fir.box<!fir.ptr<i32>>>
    %4 = fir.box_addr %3 : (!fir.box<!fir.ptr<i32>>) -> !fir.ptr<i32>
    fir.store %c10_i32 to %4 : !fir.ptr<i32>
    omp.terminator
  }
  return
}

While lowering to LLVM, you can hence do this in fewer steps.

for (auto &devPtrOp : useDevPtrOperands) {
  llvm::Value *mapOpValue = moduleTranslation.lookupValue(devPtrOp);
  const auto &arg = getTheArgumentAssociatedWith(devPtrOp)
  moduleTranslation.mapValue(arg,
                             info.DevicePtrInfoMap[mapOpValue].second);
}

For handling entry block arguments, you can refer to both the wsloop op or the atomic update op.

Jun 15 2023, 6:31 AM · Restricted Project, Restricted Project, Restricted Project

Jun 14 2023

TIFitis updated the diff for D152554: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder.

Fixed typo

Jun 14 2023, 9:55 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D152554: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder.

Rebased

Jun 14 2023, 9:46 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added a comment to D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.

Weren't you planning to make the device_ptr a block argument operand?

Jun 14 2023, 5:53 AM · Restricted Project, Restricted Project, Restricted Project

Jun 13 2023

TIFitis requested review of D152824: [MLIR][OpenMP]Add Flang lowering support for device_ptr and device_addr clauses.
Jun 13 2023, 9:10 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis requested review of D152822: [MLIR][OpenMP] Minor change to assembly format for Target Data op.
Jun 13 2023, 9:05 AM · Restricted Project, Restricted Project
TIFitis updated the diff for D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.

Rebased

Jun 13 2023, 5:05 AM · Restricted Project, Restricted Project, Restricted Project

Jun 12 2023

TIFitis added inline comments to D146557: [MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder.
Jun 12 2023, 3:27 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D146557: [MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder.

Update MLIR BodyGen callback.

Jun 12 2023, 3:07 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D146557: [MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder.

Addressed reviewer comments.

Jun 12 2023, 2:31 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D152554: [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder.

Rebased

Jun 12 2023, 9:33 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D150860: [OpenMP] Change clang emitTargetDataCalls to use OMPIRBuilder.

Rebased

Jun 12 2023, 9:04 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis added inline comments to D146557: [MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder.
Jun 12 2023, 8:31 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis updated the diff for D146557: [MLIR][OpenMP] Refactoring createTargetData in OMPIRBuilder.

Addressed reviewer comments.

Jun 12 2023, 8:31 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
TIFitis committed rG3401a5f7584a: [OpenMP][OMPIRBuilder] Migrate emitOffloadingArrays and… (authored by TIFitis).
[OpenMP][OMPIRBuilder] Migrate emitOffloadingArrays and…
Jun 12 2023, 7:43 AM · Restricted Project, Restricted Project, Restricted Project
TIFitis closed D149872: [OpenMP][OMPIRBuilder] Migrate emitOffloadingArrays and EmitNonContiguousDescriptor from Clang.
Jun 12 2023, 7:43 AM · Restricted Project, Restricted Project, Restricted Project