Skip to content

Commit

Permalink
[XeGPUToVC] Add target based legality check for MathToVC patterns ear… (
Browse files Browse the repository at this point in the history
#950)

[XeGPUToVC] Add target based legality check for MathToVC patterns early in the pass.

Configuring the legality for MathToVC pass has to be done early.
Since, XeGPUToVC makes some arith ops dynamically legal in the target environment.
Making the whole dialect legal (needed for MathToVC) has to be done before conditionally making some ops legal.

Also add MathToVC as the link target for the XeGPUToVC pass.
  • Loading branch information
mshahneo authored Nov 1, 2024
1 parent 3b8c2af commit ffb8bf0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/Conversion/XeGPUToVC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_imex_conversion_library(IMEXXeGPUToVC
#LINK_COMPONENTS

LINK_LIBS PUBLIC
IMEXMathToVC
MLIRIR
MLIRSupport
# MLIRTransforms
Expand Down
5 changes: 3 additions & 2 deletions lib/Conversion/XeGPUToVC/XeGPUToVC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,9 @@ struct XeGPUToVCPass : public imex::impl::ConvertXeGPUToVCBase<XeGPUToVCPass> {
RewritePatternSet patterns(&getContext());
ConversionTarget target(getContext());

// Configure the legality of the conversion target for MathToVC patterns.
configureMathToVCConversionLegality(target);

target.addLegalDialect<func::FuncDialect, arith::ArithDialect,
memref::MemRefDialect, vector::VectorDialect>();
target.addIllegalDialect<xegpu::XeGPUDialect>();
Expand Down Expand Up @@ -960,8 +963,6 @@ struct XeGPUToVCPass : public imex::impl::ConvertXeGPUToVCBase<XeGPUToVCPass> {

populateMathToVCPatterns(typeConverter, patterns);

configureMathToVCConversionLegality(target);

if (failed(applyPartialConversion(m, target, std::move(patterns))))
return signalPassFailure();
}
Expand Down

0 comments on commit ffb8bf0

Please sign in to comment.