Skip to content

Commit

Permalink
add initial set of lowerings for MPI dialect
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLydike committed Jun 28, 2024
1 parent ac40463 commit e6d70ab
Show file tree
Hide file tree
Showing 9 changed files with 454 additions and 1 deletion.
104 changes: 104 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
inputs = {
flake-utils.follows = "nix-vscode-extensions/flake-utils";
nixpkgs.follows = "nix-vscode-extensions/nixpkgs";
};

outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};

devShells.default = pkgs.mkShell {
buildInputs = [
packages.default
pkgs.git pkgs.ripgrep pkgs.gdb pkgs.clang-tools
pkgs.cmake pkgs.ninja pkgs.clang pkgs.lld pkgs.chrpath
pkgs.fish pkgs.neovim pkgs.git pkgs.libclang
pkgs.ccache
] ;
shellHook = ''
export CC=clang
export CXX=clang++
'';
};
in
{
inherit packages devShells;
});
}
30 changes: 30 additions & 0 deletions mlir/include/mlir/Conversion/MPIToLLVM/MPIToLLVM.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_CONVERSION_MPITOLLVM_H
#define MLIR_CONVERSION_MPITOLLVM_H

#include "mlir/IR/DialectRegistry.h"

namespace mlir {

class LLVMTypeConverter;
class RewritePatternSet;

#define GEN_PASS_DECL_MPITOLLVMCONVERSIONPASS
#include "mlir/Conversion/Passes.h.inc"

namespace mpi {
void populateMPIToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);

void registerConvertMPIToLLVMInterface(DialectRegistry &registry);

} // namespace mpi
} // namespace mlir

#endif // MLIR_CONVERSION_MPITOLLVM_H
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/MPI/IR/MPITypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MPI_Type<string name, string typeMnemonic, list<Trait> traits = []>
//===----------------------------------------------------------------------===//

def MPI_Retval : MPI_Type<"Retval", "retval"> {
let summary = "MPI function call return value";
let summary = "MPI function call return value (!mpi.retval)";
let description = [{
This type represents a return value from an MPI function call.
This value can be MPI_SUCCESS, MPI_ERR_IN_STATUS, or any error code.
Expand Down
2 changes: 2 additions & 0 deletions mlir/include/mlir/InitAllExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#ifndef MLIR_INITALLEXTENSIONS_H_
#define MLIR_INITALLEXTENSIONS_H_

#include "Conversion/MPIToLLVM/MPIToLLVM.h"
#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
#include "mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h"
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
Expand Down Expand Up @@ -62,6 +63,7 @@ inline void registerAllExtensions(DialectRegistry &registry) {
registerConvertFuncToLLVMInterface(registry);
index::registerConvertIndexToLLVMInterface(registry);
registerConvertMathToLLVMInterface(registry);
mpi::registerConvertMPIToLLVMInterface(registry);
registerConvertMemRefToLLVMInterface(registry);
registerConvertNVVMToLLVMInterface(registry);
ub::registerConvertUBToLLVMInterface(registry);
Expand Down
1 change: 1 addition & 0 deletions mlir/lib/Conversion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ add_subdirectory(MathToSPIRV)
add_subdirectory(MemRefToEmitC)
add_subdirectory(MemRefToLLVM)
add_subdirectory(MemRefToSPIRV)
add_subdirectory(MPIToLLVM)
add_subdirectory(NVGPUToNVVM)
add_subdirectory(NVVMToLLVM)
add_subdirectory(OpenACCToSCF)
Expand Down
17 changes: 17 additions & 0 deletions mlir/lib/Conversion/MPIToLLVM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
add_mlir_conversion_library(MLIRMPIToLLVM
MPIToLLVM.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/MPIToLLVM

DEPENDS
MLIRConversionPassIncGen

LINK_COMPONENTS
Core

LINK_LIBS PUBLIC
MLIRLLVMCommonConversion
MLIRLLVMDialect
MLIRMPIDialect
)
Loading

0 comments on commit e6d70ab

Please sign in to comment.