From 66d4ad160edc94098399434ec295ccb91a6f9636 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Mon, 4 Dec 2023 22:21:37 +0900 Subject: [PATCH] Refactor --- melior/src/pass/async.rs | 17 +++++++++------- melior/src/pass/gpu.rs | 15 +++++++++------ melior/src/pass/linalg.rs | 27 ++++++++++++++------------ melior/src/pass/sparse_tensor.rs | 21 +++++++++++--------- melior/src/pass/transform.rs | 33 +++++++++++++++++--------------- 5 files changed, 64 insertions(+), 49 deletions(-) diff --git a/melior/src/pass/async.rs b/melior/src/pass/async.rs index 53effd3f71..30ea238c7d 100644 --- a/melior/src/pass/async.rs +++ b/melior/src/pass/async.rs @@ -1,10 +1,13 @@ //! Async passes. -melior_macro::async_passes!( - mlirCreateAsyncAsyncFuncToAsyncRuntime, - mlirCreateAsyncAsyncParallelFor, - mlirCreateAsyncAsyncRuntimePolicyBasedRefCounting, - mlirCreateAsyncAsyncRuntimeRefCounting, - mlirCreateAsyncAsyncRuntimeRefCountingOpt, - mlirCreateAsyncAsyncToAsyncRuntime, +melior_macro::passes!( + "Async", + [ + mlirCreateAsyncAsyncFuncToAsyncRuntime, + mlirCreateAsyncAsyncParallelFor, + mlirCreateAsyncAsyncRuntimePolicyBasedRefCounting, + mlirCreateAsyncAsyncRuntimeRefCounting, + mlirCreateAsyncAsyncRuntimeRefCountingOpt, + mlirCreateAsyncAsyncToAsyncRuntime, + ] ); diff --git a/melior/src/pass/gpu.rs b/melior/src/pass/gpu.rs index d89bc36e87..daa2a3aea1 100644 --- a/melior/src/pass/gpu.rs +++ b/melior/src/pass/gpu.rs @@ -1,9 +1,12 @@ //! GPU passes. -melior_macro::gpu_passes!( - // spell-checker: disable-next-line - mlirCreateGPUGpuAsyncRegionPass, - mlirCreateGPUGpuKernelOutlining, - mlirCreateGPUGpuLaunchSinkIndexComputations, - mlirCreateGPUGpuMapParallelLoopsPass, +melior_macro::passes!( + "GPU", + [ + // spell-checker: disable-next-line + mlirCreateGPUGpuAsyncRegionPass, + mlirCreateGPUGpuKernelOutlining, + mlirCreateGPUGpuLaunchSinkIndexComputations, + mlirCreateGPUGpuMapParallelLoopsPass, + ] ); diff --git a/melior/src/pass/linalg.rs b/melior/src/pass/linalg.rs index 067127264d..00b091d6d1 100644 --- a/melior/src/pass/linalg.rs +++ b/melior/src/pass/linalg.rs @@ -1,15 +1,18 @@ //! Linalg passes. -melior_macro::linalg_passes!( - mlirCreateLinalgConvertElementwiseToLinalg, - mlirCreateLinalgLinalgBufferize, - mlirCreateLinalgLinalgDetensorize, - mlirCreateLinalgLinalgElementwiseOpFusion, - mlirCreateLinalgLinalgFoldUnitExtentDims, - mlirCreateLinalgLinalgGeneralization, - mlirCreateLinalgLinalgInlineScalarOperands, - mlirCreateLinalgLinalgLowerToAffineLoops, - mlirCreateLinalgLinalgLowerToLoops, - mlirCreateLinalgLinalgLowerToParallelLoops, - mlirCreateLinalgLinalgNamedOpConversion, +melior_macro::passes!( + "Linalg", + [ + mlirCreateLinalgConvertElementwiseToLinalg, + mlirCreateLinalgLinalgBufferize, + mlirCreateLinalgLinalgDetensorize, + mlirCreateLinalgLinalgElementwiseOpFusion, + mlirCreateLinalgLinalgFoldUnitExtentDims, + mlirCreateLinalgLinalgGeneralization, + mlirCreateLinalgLinalgInlineScalarOperands, + mlirCreateLinalgLinalgLowerToAffineLoops, + mlirCreateLinalgLinalgLowerToLoops, + mlirCreateLinalgLinalgLowerToParallelLoops, + mlirCreateLinalgLinalgNamedOpConversion, + ] ); diff --git a/melior/src/pass/sparse_tensor.rs b/melior/src/pass/sparse_tensor.rs index 60ef80b232..c8544bc46d 100644 --- a/melior/src/pass/sparse_tensor.rs +++ b/melior/src/pass/sparse_tensor.rs @@ -1,12 +1,15 @@ //! Sparse tensor passes. -melior_macro::sparse_tensor_passes!( - mlirCreateSparseTensorPostSparsificationRewrite, - mlirCreateSparseTensorPreSparsificationRewrite, - mlirCreateSparseTensorSparseBufferRewrite, - mlirCreateSparseTensorSparseTensorCodegen, - mlirCreateSparseTensorSparseTensorConversionPass, - mlirCreateSparseTensorSparseVectorization, - mlirCreateSparseTensorSparsificationPass, - mlirCreateSparseTensorStorageSpecifierToLLVM, +melior_macro::passes!( + "SparseTensor", + [ + mlirCreateSparseTensorPostSparsificationRewrite, + mlirCreateSparseTensorPreSparsificationRewrite, + mlirCreateSparseTensorSparseBufferRewrite, + mlirCreateSparseTensorSparseTensorCodegen, + mlirCreateSparseTensorSparseTensorConversionPass, + mlirCreateSparseTensorSparseVectorization, + mlirCreateSparseTensorSparsificationPass, + mlirCreateSparseTensorStorageSpecifierToLLVM, + ] ); diff --git a/melior/src/pass/transform.rs b/melior/src/pass/transform.rs index aaa09c6660..657e9f554a 100644 --- a/melior/src/pass/transform.rs +++ b/melior/src/pass/transform.rs @@ -1,18 +1,21 @@ //! Transform passes. -melior_macro::transform_passes!( - mlirCreateTransformsCSE, - mlirCreateTransformsCanonicalizer, - mlirCreateTransformsControlFlowSink, - mlirCreateTransformsGenerateRuntimeVerification, - mlirCreateTransformsInliner, - mlirCreateTransformsLocationSnapshot, - mlirCreateTransformsLoopInvariantCodeMotion, - mlirCreateTransformsPrintOpStats, - mlirCreateTransformsSCCP, - mlirCreateTransformsStripDebugInfo, - mlirCreateTransformsSymbolDCE, - mlirCreateTransformsSymbolPrivatize, - mlirCreateTransformsTopologicalSort, - mlirCreateTransformsViewOpGraph, +melior_macro::passes!( + "Transforms", + [ + mlirCreateTransformsCSE, + mlirCreateTransformsCanonicalizer, + mlirCreateTransformsControlFlowSink, + mlirCreateTransformsGenerateRuntimeVerification, + mlirCreateTransformsInliner, + mlirCreateTransformsLocationSnapshot, + mlirCreateTransformsLoopInvariantCodeMotion, + mlirCreateTransformsPrintOpStats, + mlirCreateTransformsSCCP, + mlirCreateTransformsStripDebugInfo, + mlirCreateTransformsSymbolDCE, + mlirCreateTransformsSymbolPrivatize, + mlirCreateTransformsTopologicalSort, + mlirCreateTransformsViewOpGraph, + ] );