CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
94 lines
3.7 KiB
C++
94 lines
3.7 KiB
C++
//===------ TestRemarkPipeline.cpp --- dynamic pipeline test pass --------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements a pass to test the dynamic pipeline feature.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/IR/BuiltinOps.h"
|
|
#include "mlir/IR/Location.h"
|
|
#include "mlir/IR/Remarks.h"
|
|
#include "mlir/Pass/Pass.h"
|
|
#include "mlir/Pass/PassManager.h"
|
|
#include "mlir/Support/WalkResult.h"
|
|
|
|
using namespace mlir;
|
|
|
|
namespace {
|
|
|
|
class TestRemarkPass : public PassWrapper<TestRemarkPass, OperationPass<>> {
|
|
public:
|
|
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestRemarkPass)
|
|
|
|
StringRef getArgument() const final { return "test-remark"; }
|
|
StringRef getDescription() const final {
|
|
return "Tests the remark pipeline feature";
|
|
}
|
|
|
|
TestRemarkPass() = default;
|
|
|
|
void runOnOperation() override {
|
|
|
|
getOperation()->walk([](Operation *op) {
|
|
if (isa<ModuleOp>(op))
|
|
return WalkResult::advance();
|
|
Location loc = op->getLoc();
|
|
mlir::remark::missed(loc, remark::RemarkOpts::name("test-remark")
|
|
.category("a-category-1-missed"))
|
|
<< remark::add("This is a test missed remark")
|
|
<< remark::reason("because we are testing the remark pipeline")
|
|
<< remark::suggest("try using the remark pipeline feature");
|
|
mlir::remark::passed(
|
|
loc,
|
|
remark::RemarkOpts::name("test-remark").category("category-1-passed"))
|
|
<< remark::add("This is a test passed remark (should be dropped)")
|
|
<< remark::reason("because we are testing the remark pipeline")
|
|
<< remark::suggest("try using the remark pipeline feature");
|
|
mlir::remark::passed(
|
|
loc,
|
|
remark::RemarkOpts::name("test-remark").category("category-1-passed"))
|
|
<< remark::add("This is a test passed remark")
|
|
<< remark::reason("because we are testing the remark pipeline")
|
|
<< remark::suggest("try using the remark pipeline feature");
|
|
|
|
mlir::remark::failed(
|
|
loc,
|
|
remark::RemarkOpts::name("test-remark").category("category-2-failed"))
|
|
<< remark::add("This is a test failed remark")
|
|
<< remark::reason("because we are testing the remark pipeline")
|
|
<< remark::suggest("try using the remark pipeline feature");
|
|
|
|
mlir::remark::analysis(loc, remark::RemarkOpts::name("test-remark")
|
|
.category("category-2-analysis"))
|
|
<< remark::add("This is a test analysis remark");
|
|
|
|
// Test remark linking: emit an analysis remark, then link a passed
|
|
// remark to it using relatedTo on RemarkOpts (no manual ID threading).
|
|
auto analysisRemark = mlir::remark::analysis(
|
|
loc,
|
|
remark::RemarkOpts::name("test-remark").category("category-link"));
|
|
analysisRemark << remark::add("Analysis that enables optimization");
|
|
|
|
// The passed remark finds the analysis via relatedTo on RemarkOpts:
|
|
mlir::remark::passed(loc, remark::RemarkOpts::name("test-remark")
|
|
.category("category-link")
|
|
.relatedTo(analysisRemark))
|
|
<< remark::add("Optimization enabled by analysis");
|
|
|
|
return WalkResult::advance();
|
|
});
|
|
}
|
|
};
|
|
} // namespace
|
|
|
|
namespace mlir {
|
|
namespace test {
|
|
void registerTestRemarkPass() { PassRegistration<TestRemarkPass>(); }
|
|
} // namespace test
|
|
} // namespace mlir
|