Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions mlir/include/RegisterAllPasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "Test/Transforms/Passes.h"
#include "hlo-extensions/Transforms/Passes.h"

#include "Transport/Transforms/Passes.h"

namespace catalyst {

inline void registerAllPasses()
Expand All @@ -44,6 +46,7 @@ inline void registerAllPasses()
qref::registerQRefPasses();
quantum::registerQuantumPasses();
rtio::registerRTIOPasses();
transport::registerTransportPasses();
test::registerTestPasses();
}

Expand Down
1 change: 1 addition & 0 deletions mlir/include/Transport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_subdirectory(IR)
add_subdirectory(Transforms)
4 changes: 4 additions & 0 deletions mlir/include/Transport/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(LLVM_TARGET_DEFINITIONS Passes.td)
mlir_tablegen(Passes.h.inc -gen-pass-decls -name Transport)
add_public_tablegen_target(MLIRTransportPassIncGen)
add_mlir_doc(Passes TransportPasses ./ -gen-pass-doc)
30 changes: 30 additions & 0 deletions mlir/include/Transport/Transforms/Passes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2026 Xanadu Quantum Technologies Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include "mlir/Pass/Pass.h"

#include "Transport/IR/TransportDialect.h"
#include "Transport/IR/TransportOps.h"

namespace catalyst {
namespace transport {

#define GEN_PASS_DECL
#define GEN_PASS_REGISTRATION
#include "Transport/Transforms/Passes.h.inc"

} // namespace transport
} // namespace catalyst
32 changes: 32 additions & 0 deletions mlir/include/Transport/Transforms/Passes.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2026 Xanadu Quantum Technologies Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef TRANSPORT_PASSES
#define TRANSPORT_PASSES

include "mlir/Pass/PassBase.td"

def ConvertTransportToLLVMPass : Pass<"convert-transport-to-llvm", "mlir::ModuleOp"> {
let summary = "Lower the transport dialect to LLVM dialect with runtime calls.";
let description = [{
Lowers each `transport` op to an `llvm.call` on the matching
`__catalyst__transport__*` symbol.
}];

let dependentDialects = [
"mlir::LLVM::LLVMDialect"
];
}

#endif // TRANSPORT_PASSES
1 change: 1 addition & 0 deletions mlir/lib/Driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ set(LIBS
MLIRRTIO
rtio-transforms
MLIRTransport
transport-transforms
MLIRCatalystTest
${ENZYME_LIB}
fmt::fmt
Expand Down
1 change: 1 addition & 0 deletions mlir/lib/Transport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_subdirectory(IR)
add_subdirectory(Transforms)
25 changes: 25 additions & 0 deletions mlir/lib/Transport/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
set(LIBRARY_NAME transport-transforms)

file(GLOB SRC
TransportToLLVM.cpp
)

get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
set(LIBS
${dialect_libs}
${conversion_libs}
MLIRTransport
)

set(DEPENDS
MLIRTransportPassIncGen
MLIRTransportEnumsIncGen
)

add_mlir_library(${LIBRARY_NAME} STATIC ${SRC} LINK_LIBS PRIVATE ${LIBS} DEPENDS ${DEPENDS})
target_compile_features(${LIBRARY_NAME} PUBLIC cxx_std_20)
target_include_directories(${LIBRARY_NAME} PUBLIC
.
${PROJECT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include)
Loading
Loading