Skip to content

Commit

Permalink
Explicit registration of codegen dialect. (#2468)
Browse files Browse the repository at this point in the history
* Explicit registration of codegen dialect.

Modify the cudaq-opt tool so that it explicit registers the codegen dialect.
This change enables easier experimentation and has no effect on the existing
compiler flow.

Signed-off-by: Eric Schweitz <[email protected]>

* Update comment.

Signed-off-by: Eric Schweitz <[email protected]>

---------

Signed-off-by: Eric Schweitz <[email protected]>
  • Loading branch information
schweitzpgi authored Dec 13, 2024
1 parent 912816f commit fa63aa2
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 5 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion include/cudaq/Optimizer/InitAllDialects.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inline void registerAllDialects(mlir::DialectRegistry &registry) {
mlir::math::MathDialect,
mlir::memref::MemRefDialect,

// NVQ++ dialects
// CUDA-Q dialects
cudaq::cc::CCDialect,
quake::QuakeDialect
>();
Expand Down
2 changes: 1 addition & 1 deletion lib/Optimizer/CodeGen/CodeGenDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* the terms of the Apache License 2.0 which accompanies this distribution. *
******************************************************************************/

#include "CodeGenDialect.h"
#include "cudaq/Optimizer/CodeGen/CodeGenDialect.h"
#include "CodeGenOps.h"
#include "mlir/IR/DialectImplementation.h"

Expand Down
2 changes: 1 addition & 1 deletion lib/Optimizer/CodeGen/CodeGenTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
******************************************************************************/

#include "CodeGenTypes.h"
#include "CodeGenDialect.h"
#include "cudaq/Optimizer/CodeGen/CodeGenDialect.h"
#include "llvm/ADT/TypeSwitch.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/DialectImplementation.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/Optimizer/CodeGen/ConvertCCToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* the terms of the Apache License 2.0 which accompanies this distribution. *
******************************************************************************/

#include "CodeGenDialect.h"
#include "cudaq/Optimizer/Builder/Intrinsics.h"
#include "cudaq/Optimizer/CodeGen/CCToLLVM.h"
#include "cudaq/Optimizer/CodeGen/CodeGenDialect.h"
#include "cudaq/Optimizer/CodeGen/Passes.h"
#include "cudaq/Optimizer/Dialect/CC/CCOps.h"
#include "cudaq/Optimizer/Dialect/CC/CCTypes.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/Optimizer/CodeGen/PassDetails.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include "CodeGenDialect.h"
#include "cudaq/Optimizer/CodeGen/CodeGenDialect.h"
#include "cudaq/Optimizer/Dialect/CC/CCDialect.h"
#include "cudaq/Optimizer/Dialect/Quake/QuakeDialect.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
Expand Down
2 changes: 2 additions & 0 deletions tools/cudaq-opt/cudaq-opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* the terms of the Apache License 2.0 which accompanies this distribution. *
******************************************************************************/

#include "cudaq/Optimizer/CodeGen/CodeGenDialect.h"
#include "cudaq/Optimizer/CodeGen/Passes.h"
#include "cudaq/Optimizer/Dialect/CC/CCDialect.h"
#include "cudaq/Optimizer/Dialect/Common/InlinerInterface.h"
Expand Down Expand Up @@ -75,6 +76,7 @@ int main(int argc, char **argv) {

mlir::DialectRegistry registry;
cudaq::registerAllDialects(registry);
registry.insert<cudaq::codegen::CodeGenDialect>();
registerInlinerExtension(registry);
return mlir::asMainReturnCode(
mlir::MlirOptMain(argc, argv, "nvq++ optimizer\n", registry));
Expand Down

0 comments on commit fa63aa2

Please sign in to comment.