Skip to content

Add attribute to capture lowering configuration. - #5842

Merged
MaheshRavishankar merged 10 commits into
iree-org:mainfrom
MaheshRavishankar:dynamic_pass_pipeline
May 19, 2021
Merged

MaheshRavishankar merged 10 commits into
iree-org:mainfrom
MaheshRavishankar:dynamic_pass_pipeline

Conversation

@MaheshRavishankar

@MaheshRavishankar MaheshRavishankar commented May 11, 2021 •

Copy link
Copy Markdown
Collaborator

Current approach to capturing lowering configuration is to use a C++
object. This was added temporarily, but has become load-bearing. A
(slightly) better approach is to just compute the configuration and
add it as an attribute on the operation. All the lowering through
tiling and vectorization then uses this attribute.
The use of the attribute is plumbed through on the CPU side at this
time.

This is the first step towards using dynamic pass pipeline usage.

Depends on D102310

nestedModulePM.addNestedPass<FuncOp>(createCanonicalizerPass());
nestedModulePM.addNestedPass<FuncOp>(
createLinalgTileAndVectorizeWorkgroupsPass());
// nestedModulePM.addNestedPass<FuncOp>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this needs to be commented ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting a failure on VMVX backend. Something is not setup correctly. After the CPU backend moves to use dynamic pass pipelines, the way this is done in VMVX can be cleaned up as well. So disabling this till that PR lands. See #5925 . Ill link that issue here.

@asaadaldien asaadaldien left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, lets after we check performance is on the same bar (in theory it should be :))

@MaheshRavishankar
MaheshRavishankar force-pushed the dynamic_pass_pipeline branch 2 times, most recently from 5ade304 to f4420e5 Compare May 18, 2021 15:58

@antiagainst antiagainst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW I used to have some prototype over the CodeGen attributes, using more structured TableGen definitions. Posted them at antiagainst@7ccc75f just in case you may find something there useful there. :)

#ifndef IREE_CONVERSION_COMMON_LOWERINGCONFIG
#define IREE_CONVERSION_COMMON_LOWERINGCONFIG

// Putting this in HAL dialect for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IREE dialect might be a better place IMO.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ben suggested putting this in HAL dialect.

MaheshRavishankar added 9 commits May 18, 2021 22:23
Current approach to capturing lowering configuration is to use a C++
object. This was added temporarily, but has become load-bearing. A
(slightly) better approach is to just compute the configuration and
add it as an attribute on the operation. All the lowering through
tiling and vectorization then uses this attribute.
The use of the attribute is plumbed through on the CPU side at this
time.

This is the first step towards using dynamic pass pipeline usage.
…ing config.

Since the lowering configuration might be shared by many ops, to clean
up the IR printed, use attribute alias to print the config as follows

```
...
linalg.matmul { lowering.config = #config }

```

To enable this the lowering configuration definition is moved into the
HAL dialect since the interface that is needed is a Dialect interface.
@MaheshRavishankar
MaheshRavishankar enabled auto-merge (squash) May 19, 2021 05:53
@MaheshRavishankar
MaheshRavishankar merged commit b5f3dda into iree-org:main May 19, 2021
@hanhanW hanhanW mentioned this pull request May 19, 2021
copybara-service Bot pushed a commit that referenced this pull request May 19, 2021
* 367468b Fix tests for shift operations (#5952)
* 577d9d9 Integrate MLIR-EmitC at iml130/mlir-emitc@0b9d50b (#5936)
* b5f3dda Add attribute to capture lowering configuration. (#5842)
* 4b31bd9 Initial Adding ROCM HAL Backend to Experimental (#5943)
* 3bdcea8 Merge google -> main (#5947)
* 90368f1 Remove file left during renaming from LinagToNVVM to LinalgToLLVMGPU (#5940)

COPYBARA_INTEGRATE_REVIEW=#5954 from hanhanW:main-to-google 367468b
PiperOrigin-RevId: 374687876
iree-github-actions-bot pushed a commit that referenced this pull request May 19, 2021
* 367468b Fix tests for shift operations (#5952)
* 577d9d9 Integrate MLIR-EmitC at iml130/mlir-emitc@0b9d50b (#5936)
* b5f3dda Add attribute to capture lowering configuration. (#5842)
* 4b31bd9 Initial Adding ROCM HAL Backend to Experimental (#5943)
* 3bdcea8 Merge google -> main (#5947)
* 90368f1 Remove file left during renaming from LinagToNVVM to LinalgToLLVMGPU (#5940)

PiperOrigin-RevId: 374687876
@MaheshRavishankar
MaheshRavishankar deleted the dynamic_pass_pipeline branch August 23, 2021 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants