Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6f4a838
experiment on the ticket 555, not working
erizheng-amd Apr 1, 2026
fb0b657
Adding temp experiment flag for upcoming change
erizheng-amd Apr 1, 2026
f3ebce2
fixing test failure due to IR change
erizheng-amd Apr 2, 2026
fefe127
updating tests to check for [1 1 1]
erizheng-amd Apr 6, 2026
6298d6b
update test with explicit call on mhal
erizheng-amd Apr 6, 2026
604bd14
Fixing the compute errors caused by removin mhal functions
erizheng-amd Apr 6, 2026
be03d19
Removing redundant includes and experiment flags
erizheng-amd Apr 6, 2026
a9ea3c9
Merge branch 'develop' into eric-555
erizheng-amd Apr 6, 2026
89e49c1
Merge branch 'develop' into eric-555
erizheng-amd Apr 9, 2026
8e58246
extra fix after merge
erizheng-amd Apr 9, 2026
cd1b606
Fixing Clang-Format issue
erizheng-amd Apr 9, 2026
1a58b33
Merge branch 'develop' into eric-555
erizheng-amd Apr 13, 2026
bb21f09
fix nightly lit test errors
erizheng-amd Apr 13, 2026
65067b1
Fix on other lit tests explicitly using mhal launch and mhal await
erizheng-amd Apr 13, 2026
685fca3
Merge branch 'develop' into eric-555
erizheng-amd Apr 13, 2026
92472e8
Merge branch 'develop' into eric-555
erizheng-amd Apr 14, 2026
78a0dcd
Addressing PR comments
erizheng-amd Apr 14, 2026
2111b16
Full removal for mhal.launch and mhal.await support
erizheng-amd Apr 14, 2026
07ed9ad
small fix
erizheng-amd Apr 14, 2026
53c3119
small fix
erizheng-amd Apr 14, 2026
fa51897
Merge branch 'develop' into eric-555
erizheng-amd Apr 16, 2026
95a64ad
Merge branch 'develop' into eric-555
erizheng-amd Apr 20, 2026
0f86aa7
Merge branch 'develop' into eric-555
erizheng-amd Apr 30, 2026
7354be4
Addressing AI Agent Reviews
erizheng-amd Apr 30, 2026
8373389
Address AI Review
erizheng-amd Apr 30, 2026
6b9a162
addressing new AI review comments
erizheng-amd May 1, 2026
2ea4f82
fix in mlir-hal project
erizheng-amd May 1, 2026
4cb8053
Merge branch 'develop' into eric-555
erizheng-amd May 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
389 changes: 214 additions & 175 deletions external/mlir-hal/lib/Conversion/MHALToGPU/MHALToGPU.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#ifndef MLIR_CONVERSION_MIGRAPHXTOLINALG_H
#define MLIR_CONVERSION_MIGRAPHXTOLINALG_H

#include "mlir/Dialect/MIGraphX/IR/MIGraphX.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"

Expand All @@ -40,9 +38,6 @@ void populateMIGraphXToLinalgBoundaryDialectConversion(
void populateMIGraphXFuncBoundaryToLinalgConversionPatterns(
RewritePatternSet &target, TypeConverter &typeConverter);

/// Populates conversion patterns for function boundaries mhal.launcher
void populateMIGraphXToLinalgMHALLauncherConversion(
RewritePatternSet &target, TypeConverter &typeConverter);
} // namespace migraphx
} // namespace mlir

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
#ifndef MLIR_CONVERSION_MIGRAPHXTOTOSA_H
#define MLIR_CONVERSION_MIGRAPHXTOTOSA_H

#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/MHAL/IR/MHAL.h"
#include "mlir/Dialect/MIGraphX/IR/MIGraphX.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/DialectConversion.h"

namespace mlir {
Expand Down
5 changes: 0 additions & 5 deletions mlir/lib/Conversion/MIGraphXToLinalg/MIGraphXToLinalg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
//
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/MIGraphXToLinalg/MIGraphXToLinalg.h"
#include "mlir/Conversion/MIGraphXToTosa/MIGraphXToTosa.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
Expand Down Expand Up @@ -1242,10 +1241,6 @@ void mlir::migraphx::populateMIGraphXFuncBoundaryToLinalgConversionPatterns(
RewritePatternSet &patterns, TypeConverter &typeConverter) {
patterns.add<AsUnderlyingShapeConverter, AsLogicalShapeOpConverter>(
typeConverter, patterns.getContext());

// mhal.launch can be generated through rocmlir-gen, so we need a way to
// legalize it
populateMIGraphXToLinalgMHALLauncherConversion(patterns, typeConverter);
populateAnyFunctionOpInterfaceTypeConversionPattern(patterns, typeConverter);
populateReturnOpTypeConversionPattern(patterns, typeConverter);
populateCallOpTypeConversionPattern(patterns, typeConverter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/MIGraphX/IR/MIGraphX.h"
#include "mlir/Dialect/Rock/IR/Rock.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"

using namespace mlir;
Expand Down Expand Up @@ -53,11 +52,6 @@ void mlir::migraphx::populateMIGraphXToLinalgBoundaryDialectConversion(
target.addDynamicallyLegalOp<func::FuncOp>([&](func::FuncOp op) {
return typeConverter.isSignatureLegal(op.getFunctionType());
});
target.addDynamicallyLegalOp<mhal::LaunchOp>(
[=](mhal::LaunchOp op) -> std::optional<bool> {
return typeConverter.isLegal(op.getResultTypes()) &&
typeConverter.isLegal(op.getOperandTypes());
});
target.addDynamicallyLegalOp<func::ReturnOp>(
[&](func::ReturnOp op) { return typeConverter.isLegal(op); });
target.addDynamicallyLegalOp<func::CallOp>(
Expand Down Expand Up @@ -97,8 +91,6 @@ void MIGraphXToLinalgPass::runOnOperation() {
boundaryConversionTarget, boundaryTypeConverter);
migraphx::populateMIGraphXFuncBoundaryToLinalgConversionPatterns(
boundaryPattern, boundaryTypeConverter);
migraphx::populateMIGraphXToLinalgMHALLauncherConversion(
boundaryPattern, boundaryTypeConverter);
if (failed(applyPartialConversion(func, boundaryConversionTarget,
std::move(boundaryPattern)))) {
return signalPassFailure();
Expand Down
41 changes: 4 additions & 37 deletions mlir/lib/Conversion/MIGraphXToTosa/MIGraphXToTosa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
//
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/MIGraphXToTosa/MIGraphXToTosa.h"
#include "mlir/Conversion/MIGraphXToLinalg/MIGraphXToLinalg.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/MHAL/IR/MHAL.h"
#include "mlir/Dialect/MIGraphX/IR/MIGraphX.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Rock/IR/Rock.h"
Expand All @@ -31,7 +29,6 @@
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/Support/Debug.h"
Expand Down Expand Up @@ -1529,14 +1526,6 @@ struct AsUnderlyingShapeConverter final
ConversionPatternRewriter &rewriter) const final;
};

/// This mirrors the call op conversion pattern but works for mhal.launch.
struct MHALLaunchConverter final : public OpConversionPattern<mhal::LaunchOp> {
using OpConversionPattern<mhal::LaunchOp>::OpConversionPattern;

LogicalResult
matchAndRewrite(mhal::LaunchOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const final;
};
} // namespace

LogicalResult AsLogicalShapeConverter::matchAndRewrite(
Expand Down Expand Up @@ -1678,26 +1667,6 @@ LogicalResult AsUnderlyingShapeConverter::matchAndRewrite(
return success();
}

LogicalResult MHALLaunchConverter::matchAndRewrite(
mhal::LaunchOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const {
// Convert the original function results.
SmallVector<Type, 2> resultTypes;
if (failed(typeConverter->convertTypes(op.getResultTypes(), resultTypes)))
return failure();

// If this isn't a one-to-one type mapping, we don't know how to aggregate
// the results.
if (op->getNumResults() != resultTypes.size())
return failure();

// Substitute with the new result types from the corresponding FuncType
// conversion.
rewriter.replaceOpWithNewOp<mhal::LaunchOp>(
op, op.getCalleeAttr(), resultTypes, adaptor.getOperands());
return success();
}

//===----------------------------------------------------------------------===//
// External interface
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -1733,14 +1702,12 @@ void migraphx::populateMIGraphXToTosaConversionPatterns(

void mlir::migraphx::populateMIGraphXFuncBoundaryToTosaConversionPatterns(
RewritePatternSet &patterns, TypeConverter &typeConverter) {

Comment thread
erizheng-amd marked this conversation as resolved.
Outdated
patterns.add<AsLogicalShapeConverter, AsUnderlyingShapeConverter,
TrivialConverter<func::ReturnOp, func::ReturnOp>,
MHALLaunchConverter>(typeConverter, patterns.getContext());
TrivialConverter<func::ReturnOp, func::ReturnOp>>(
typeConverter, patterns.getContext());
// Add upstream patterns that take care of func.func and its friends.
populateAnyFunctionOpInterfaceTypeConversionPattern(patterns, typeConverter);
populateCallOpTypeConversionPattern(patterns, typeConverter);
}
void mlir::migraphx::populateMIGraphXToLinalgMHALLauncherConversion(
RewritePatternSet &patterns, TypeConverter &typeConverter) {
patterns.add<MHALLaunchConverter>(typeConverter, patterns.getContext());
}

10 changes: 1 addition & 9 deletions mlir/lib/Conversion/MIGraphXToTosa/MIGraphXToTosaPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
#include "mlir/Conversion/MIGraphXToTosa/MIGraphXToTosa.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/MHAL/IR/MHAL.h"
Comment thread
umangyadav marked this conversation as resolved.
Outdated
#include "mlir/Dialect/MIGraphX/IR/MIGraphX.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/Passes.h"

#define DEBUG_TYPE "migraphx-to-tosa"

Expand Down Expand Up @@ -62,11 +59,6 @@ void mlir::migraphx::populateMIGraphXFuncBoundaryToTosaDialectConversion(
[=](func::CallOp op) -> std::optional<bool> {
return typeConverter->isSignatureLegal(op.getCalleeType());
});
target.addDynamicallyLegalOp<mhal::LaunchOp>(
[=](mhal::LaunchOp op) -> std::optional<bool> {
return typeConverter->isLegal(op.getResultTypes()) &&
typeConverter->isLegal(op.getOperandTypes());
});
target.addDynamicallyLegalOp<func::ReturnOp>(
[=](func::ReturnOp op) -> std::optional<bool> {
return typeConverter->isLegal(op);
Expand Down
3 changes: 1 addition & 2 deletions mlir/test/fusion/pr-e2e/mixr-conv-bias-clipped-relu.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ module {
return %7 : !migraphx.shaped<4x4x1x1xf32, 4x1x1x1>
}
func.func @mlir_convolution_add_clip_wrapper(%arg0: !migraphx.shaped<1x4x1x1xf32, 4x1x1x1>, %arg1: !migraphx.shaped<4x3x3x3xf32, 27x9x3x1>, %arg2: !migraphx.shaped<4x3x3x3xf32, 27x9x3x1>) -> !migraphx.shaped<4x4x1x1xf32, 4x1x1x1> {
%token, %results = mhal.launch @mlir_convolution_add_clip (%arg0, %arg1, %arg2) : (!migraphx.shaped<1x4x1x1xf32, 4x1x1x1>, !migraphx.shaped<4x3x3x3xf32, 27x9x3x1>, !migraphx.shaped<4x3x3x3xf32, 27x9x3x1>) -> !migraphx.shaped<4x4x1x1xf32, 4x1x1x1>
mhal.await %token : !mhal.token
%results = func.call @mlir_convolution_add_clip(%arg0, %arg1, %arg2) : (!migraphx.shaped<1x4x1x1xf32, 4x1x1x1>, !migraphx.shaped<4x3x3x3xf32, 27x9x3x1>, !migraphx.shaped<4x3x3x3xf32, 27x9x3x1>) -> !migraphx.shaped<4x4x1x1xf32, 4x1x1x1>
return %results : !migraphx.shaped<4x4x1x1xf32, 4x1x1x1>
}
module @__xmodule_ attributes {mhal.arch = "##TOKEN_ARCH##", mhal.module} {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/fusion/pr-e2e/mixr-dot-int4-f16.mlir
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: rocmlir-driver -kernel-pipeline=migraphx %s | rocmlir-gen -fut mlir_unpack_dequantizelinear_dot --arch %arch --clone-harness - | FileCheck %s --check-prefix=HASINT4
// HASINT4: mhal.launch
// HASINT4: call @mlir_unpack_dequantizelinear_dot
// HASINT4-SAME: tensor<64xi4>

// RUN: rocmlir-driver -kernel-pipeline=migraphx %s | rocmlir-gen -fut mlir_unpack_dequantizelinear_dot --arch %arch --clone-harness - | rocmlir-driver -host-pipeline=highlevel -kernel-pipeline=highlevel | rocmlir-gen -ph -fut mlir_unpack_dequantizelinear_dot_wrapper --verifier clone - | rocmlir-driver -host-pipeline mhal,runner -kernel-pipeline full | mlir-runner -O2 --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext,%conv_validation_wrapper_library_dir/libconv-validation-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_float16_utils%shlibext,%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_async_runtime%shlibext --entry-point-result=void | FileCheck %s
Expand Down
11 changes: 5 additions & 6 deletions mlir/test/fusion/pr-e2e/mixr-expand-strides-non-multiple.mlir
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// RUN: rocmlir-gen -fut mlir_dot_sigmoid --arch %arch --clone-harness %s | rocmlir-driver -kernel-pipeline=migraphx,highlevel -host-pipeline=migraphx,highlevel -targets %arch | rocmlir-gen -ph -rand 1 -rand_type float -fut mlir_dot_sigmoid_wrapper --verifier clone - | rocmlir-driver -host-pipeline mhal,runner -kernel-pipeline full -targets %arch | xmir-runner --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext,%conv_validation_wrapper_library_dir/libconv-validation-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_float16_utils%shlibext,%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_async_runtime%shlibext --entry-point-result=void | FileCheck %s
// RUN: rocmlir-gen -fut mlir_dot_sigmoid --arch %arch --clone-harness %s | rocmlir-driver -kernel-pipeline=migraphx,highlevel -host-pipeline=migraphx,highlevel -targets %arch | rocmlir-gen -ph -rand 1 -rand_type float -fut mlir_dot_sigmoid_wrapper --verifier clone -print-verify-results=always - | rocmlir-driver -host-pipeline mhal,runner -kernel-pipeline full -targets %arch | xmir-runner --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext,%conv_validation_wrapper_library_dir/libconv-validation-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_float16_utils%shlibext,%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_async_runtime%shlibext --entry-point-result=void | FileCheck %s
Comment thread
erizheng-amd marked this conversation as resolved.
Outdated

// Only ~41% of the results will be correct since the non-contiguous strides
// in this example is the result of concating 4x5x24 and 4x7x24 (i.e.m 4x12x24).
// This kernel is specificall dealing with making sure that the 4x5x24 elements
// are all in the correct place in the larger tensor.
// CHECK: relDiff = 0 : 480/1152 (41.666667%)
// Non-contiguous strides from a concat-like layout (4x5x24 and 4x7x24 in a
// 4x12x24 logical tensor). Ensures dot+sigmoid + expand-strides placement;
// with correct GPU staging, GPU matches CPU on the full output.
// CHECK: relDiff = 0 : 1152/1152 (100.000000%)

module {
func.func @mlir_dot_sigmoid(%arg0: !migraphx.shaped<4x5x16xf16, 80x16x1>, %arg1: !migraphx.shaped<4x16x24xf16, 384x24x1>) -> !migraphx.shaped<4x5x24xf16, 288x24x1> attributes {arch = "gfx1201", kernel = "mixr", num_cu = 32 : i64} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ module {
return %3 : !migraphx.shaped<2x16x8xf32, 128x8x1>
}
func.func @mlir_transpose_reshape_dot_wrapper(%arg0: !migraphx.shaped<2x8x4x4xf32, 128x16x4x1>, %arg1: !migraphx.shaped<1x8x8xf32, 64x8x1> ) -> !migraphx.shaped<2x16x8xf32, 128x8x1> {
%token, %results = mhal.launch @mlir_transpose_reshape_dot (%arg0, %arg1) : (!migraphx.shaped<2x8x4x4xf32, 128x16x4x1>, !migraphx.shaped<1x8x8xf32, 64x8x1>) -> !migraphx.shaped<2x16x8xf32, 128x8x1>
mhal.await %token : !mhal.token
%results = func.call @mlir_transpose_reshape_dot(%arg0, %arg1) : (!migraphx.shaped<2x8x4x4xf32, 128x16x4x1>, !migraphx.shaped<1x8x8xf32, 64x8x1>) -> !migraphx.shaped<2x16x8xf32, 128x8x1>
return %results : !migraphx.shaped<2x16x8xf32, 128x8x1>
}
module @__xmodule_ attributes {mhal.arch = "##TOKEN_ARCH##", mhal.module} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ module {
return %2 : !migraphx.shaped<1x6xf32, 6x1>
}
func.func @mlir_transpose_reshape_dot_wrapper(%arg0: !migraphx.shaped<1x2x1x3xf32, 6x3x3x1>, %arg1: !migraphx.shaped<6x6xf32, 6x1>) -> !migraphx.shaped<1x6xf32, 6x1> {
%token, %results = mhal.launch @mlir_transpose_reshape_dot (%arg0, %arg1) : (!migraphx.shaped<1x2x1x3xf32, 6x3x3x1>, !migraphx.shaped<6x6xf32, 6x1>) -> !migraphx.shaped<1x6xf32, 6x1>
mhal.await %token : !mhal.token
%results = func.call @mlir_transpose_reshape_dot(%arg0, %arg1) : (!migraphx.shaped<1x2x1x3xf32, 6x3x3x1>, !migraphx.shaped<6x6xf32, 6x1>) -> !migraphx.shaped<1x6xf32, 6x1>
return %results : !migraphx.shaped<1x6xf32, 6x1>
}
module @__xmodule_ attributes {mhal.arch = "##TOKEN_ARCH##", mhal.module} {
Expand Down
8 changes: 4 additions & 4 deletions mlir/test/fusion/pr-e2e/mixr-non-contiguous-strides.mlir
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: rocmlir-gen -fut mlir_dot_sigmoid --arch %arch --clone-harness %s | rocmlir-driver -kernel-pipeline=migraphx,highlevel -host-pipeline=migraphx,highlevel -targets %arch | rocmlir-gen -ph -rand 1 -rand_type float -fut mlir_dot_sigmoid_wrapper --verifier clone - | rocmlir-driver -host-pipeline mhal,runner -kernel-pipeline full -targets %arch | xmir-runner --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext,%conv_validation_wrapper_library_dir/libconv-validation-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_float16_utils%shlibext,%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_async_runtime%shlibext --entry-point-result=void | FileCheck %s
// RUN: rocmlir-gen -fut mlir_dot_sigmoid --arch %arch --clone-harness %s | rocmlir-driver -kernel-pipeline=migraphx,highlevel -host-pipeline=migraphx,highlevel -targets %arch | rocmlir-gen -ph -rand 1 -rand_type float -fut mlir_dot_sigmoid_wrapper --verifier clone -print-verify-results=always - | rocmlir-driver -host-pipeline mhal,runner -kernel-pipeline full -targets %arch | xmir-runner --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext,%conv_validation_wrapper_library_dir/libconv-validation-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_float16_utils%shlibext,%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_async_runtime%shlibext --entry-point-result=void | FileCheck %s

// Only half of the results will be correct since the non-contiguous strides
// in this example means that half of the memory is uninitialized.
// CHECK: relDiff = 0 : 2304/4608 (50.000000%)
// Non-contiguous strides: validates expand-strides / padded layout. With
// correct GPU host staging, CPU and GPU references match on the full tensor.
// CHECK: relDiff = 0 : 4608/4608 (100.000000%)

module {
func.func @mlir_dot_sigmoid(%arg0: !migraphx.shaped<4x24x16xf16, 384x16x1>, %arg1: !migraphx.shaped<4x16x24xf16, 384x24x1>) -> !migraphx.shaped<4x24x24xf16, 1152x24x1> attributes {kernel = "mixr"} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ module {
return %2 : !migraphx.shaped<1x1x32x32xf32, 1024x1024x32x1>
}
func.func @mlir_reshape_convolution_real(%arg0: !migraphx.shaped<1x1x16x1x16x1xf32, 256x256x16x16x1x1>, %arg1: !migraphx.shaped<1x1x3x3xf32, 9x9x3x1>) -> !migraphx.shaped<1x1x32x32xf32, 1024x1024x32x1> {
%token, %results = mhal.launch @mlir_reshape_convolution_real__part_0 (%arg0, %arg1) : (!migraphx.shaped<1x1x16x1x16x1xf32, 256x256x16x16x1x1>, !migraphx.shaped<1x1x3x3xf32, 9x9x3x1>) -> !migraphx.shaped<1x1x32x32xf32, 1024x1024x32x1>
mhal.await %token : !mhal.token
%results = func.call @mlir_reshape_convolution_real__part_0(%arg0, %arg1) : (!migraphx.shaped<1x1x16x1x16x1xf32, 256x256x16x16x1x1>, !migraphx.shaped<1x1x3x3xf32, 9x9x3x1>) -> !migraphx.shaped<1x1x32x32xf32, 1024x1024x32x1>
return %results : !migraphx.shaped<1x1x32x32xf32, 1024x1024x32x1>
}
module @__xmodule_ attributes {mhal.arch = "##TOKEN_ARCH##", mhal.module} {
Expand Down
7 changes: 4 additions & 3 deletions mlir/test/fusion/pr-e2e/tosa-to-rock-exp.e2e.mlir
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// RUN: rocmlir-gen -fut test_fusion --arch %arch --clone-harness %s | rocmlir-driver -host-pipeline highlevel -kernel-pipeline highlevel | rocmlir-gen -ph -fut test_fusion_wrapper -rand 1 -rand_type float --verifier clone - | rocmlir-driver -host-pipeline mhal,runner -kernel-pipeline full -targets %arch | mlir-runner -O2 --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext,%conv_validation_wrapper_library_dir/libconv-validation-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_float16_utils%shlibext -entry-point-result=void | FileCheck %s
// RUN: rocmlir-gen -fut test_fusion --arch %arch --clone-harness %s | rocmlir-driver -host-pipeline highlevel -kernel-pipeline highlevel | rocmlir-gen -ph -fut test_fusion_wrapper -rand 1 -rand_type float --verifier clone -print-verify-results=always - | rocmlir-driver -host-pipeline mhal,runner -kernel-pipeline full -targets %arch | mlir-runner -O2 --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext,%conv_validation_wrapper_library_dir/libconv-validation-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext,%linalg_test_lib_dir/libmlir_float16_utils%shlibext -entry-point-result=void | FileCheck %s

module {
// CHECK: RMS = {{.*}}e-09
// CHECK: [1 0 0]
// CHECK: Number of elements:
// CHECK: RMS = {{.*}}
// CHECK: [1 1 1]
func.func @test_fusion(%arg0: tensor<128x32x32x8xf32>, %arg1: tensor<128x3x3x8xf32>) -> tensor<128x30x30x128xf32> {

%zero = arith.constant dense<0.0> : tensor<128xf32>
Expand Down
Loading
Loading