Hello! I have a question about firtool
. I want to integrate FIRRTL
dialect, which is present in firtool
, into my project. I have downloaded the latest release version, but I’m not sure how to properly include it in the project. I know how to integrate (full) CIRCT
, but I have no idea how to integrate only part of it that is firtool
. Maybe there is some readme about it somewhere?
For Chisel project, when you download compatible version of firtool binary and made this sudo mv firtool /usr/local/bin/
it works. I guess Chisel gets it automatically. What is your project?
Thank you for your reply.
The thing is I need sources. I don’t need binary.
Maybe you can depend on just the Firtool library? circt/lib/Firtool at main · llvm/circt · GitHub
This was added so out of tree projects can re-use the same C++ building blocks that are used to build the firtool binary in their own binary tools. It also has a C API, which can be used from other languages.
Otherwise, you would probably have to decide which CMake targets you care about, and depend on them directly.
Thank you for your reply.
Maybe. I need FIRRTL
operations and the lowering passes necessary do get the LoFIRRTL
. I need FIRRTL
infrastructure (circuit
, module
s, etc.) to work with. And I need to get the minimum amount of source files to do that. The thing is I don’t know how to do it. Currently to get all necessary sources I need CIRCT
repo, which is, when built, gives the size of ~10GB. The problem, of course, lies in llvm
submodule.
If you are using CMake, I suggest starting with depending on the CIRCTFirtool library I linked above. This should include exactly what you’re looking for–the relevant dependencies to represent and lower FIRRTL dialect. If you want to be really bare bones, you could depend on just the FIRRTL dialect, parser, and transform libraries.
Thank you for your reply.
Ok, so I downloaded firtool-1.63.0
from Release firtool-1.63.0 · llvm/circt · GitHub and when I am trying to use find_package(MLIR REQUIRED CONFIG)
as I did with CIRCT
repo I get this error:
CMake Error at CMakeLists.txt:46 (find_package):
Found package configuration file:
~/firtool-1.63.0/lib/cmake/mlir/MLIRConfig.cmake
but it set MLIR_FOUND to FALSE so package "MLIR" is considered to be NOT
FOUND. Reason given by package:
The following imported targets are referenced, but are missing:
CIRCTAffineToLoopSchedule CIRCTArcToLLVM CIRCTCalyxToFSM CIRCTCalyxToHW
CIRCTCalyxNative CIRCTCombToArith CIRCTCombToLLVM CIRCTConvertToArcs
CIRCTDCToHW CIRCTExportChiselInterface CIRCTExportVerilog CIRCTFIRRTLToHW
CIRCTFSMToSV CIRCTHandshakeToDC CIRCTHandshakeToHW CIRCTHWArithToHW
CIRCTHWToLLHD CIRCTHWToLLVM CIRCTHWToBTOR2 CIRCTHWToSV CIRCTHWToSystemC
CIRCTLLHDToLLVM CIRCTLoopScheduleToCalyx CIRCTMooreToCore CIRCTPipelineToHW
CIRCTSCFToCalyx CIRCTSeqToSV CIRCTSimToSV CIRCTCFToHandshake CIRCTVerifToSV
CIRCTExportFIRRTL CIRCTComb CIRCTDebug CIRCTESI CIRCTFIRRTL CIRCTMSFT
CIRCTMSFTTransforms CIRCTHW CIRCTLLHD CIRCTMoore CIRCTOM CIRCTOMEvaluator
CIRCTSeq CIRCTSeqTransforms CIRCTSV CIRCTSVTransforms CIRCTFSM
CIRCTFSMTransforms CIRCTHandshake CIRCTHandshakeTransforms CIRCTHWArith
CIRCTVerif CIRCTLTL CIRCTFirtool
I understand that one have to integrate it a little differently than CIRCT
repo. How should one do it?
I’m not sure if anyone is building CMake projects that depend on the firtool release artifacts in this way. Are you able to share a link to how you are setting this up? I’m not sure why your find_package(MLIR)
is referencing targets from CIRCT. What happens if you first do find_package(CIRCT)
?
Same mistake:
CMake Error at ~/firtool-1.63.0/lib/cmake/circt/CIRCTConfig.cmake:10 (find_package):
Found package configuration file:
~/firtool-1.63.0/lib/cmake/mlir/MLIRConfig.cmake
but it set MLIR_FOUND to FALSE so package "MLIR" is considered to be NOT
FOUND. Reason given by package:
The following imported targets are referenced, but are missing:
CIRCTAffineToLoopSchedule CIRCTArcToLLVM CIRCTCalyxToFSM CIRCTCalyxToHW
CIRCTCalyxNative CIRCTCombToArith CIRCTCombToLLVM CIRCTConvertToArcs
CIRCTDCToHW CIRCTExportChiselInterface CIRCTExportVerilog CIRCTFIRRTLToHW
CIRCTFSMToSV CIRCTHandshakeToDC CIRCTHandshakeToHW CIRCTHWArithToHW
CIRCTHWToLLHD CIRCTHWToLLVM CIRCTHWToBTOR2 CIRCTHWToSV CIRCTHWToSystemC
CIRCTLLHDToLLVM CIRCTLoopScheduleToCalyx CIRCTMooreToCore CIRCTPipelineToHW
CIRCTSCFToCalyx CIRCTSeqToSV CIRCTSimToSV CIRCTCFToHandshake CIRCTVerifToSV
CIRCTExportFIRRTL CIRCTComb CIRCTDebug CIRCTESI CIRCTFIRRTL CIRCTMSFT
CIRCTMSFTTransforms CIRCTHW CIRCTLLHD CIRCTMoore CIRCTOM CIRCTOMEvaluator
CIRCTSeq CIRCTSeqTransforms CIRCTSV CIRCTSVTransforms CIRCTFSM
CIRCTFSMTransforms CIRCTHandshake CIRCTHandshakeTransforms CIRCTHWArith
CIRCTVerif CIRCTLTL CIRCTFirtool
Call Stack (most recent call first):
CMakeLists.txt:44 (find_package)
In a sifive internal repository we are calling find_package
for MLIR first and then CIRCT. Could you try that?
find_package(MLIR CONFIG)
find_package(CIRCT CONFIG)
That’s exactly what I did in the first time.
I filed an issue on this same problem a few months back: [CMake] Local install doesn't produce CIRCT targets in lib/cmake/mlir/MLIRTargets.cmake · Issue #6418 · llvm/circt · GitHub
This was using firtool-1.59.0
, and I just tested with firtool-1.64.0
, and the build seems to work without issue for me using find_package(CIRCT REQUIRED CONFIG)
.
Tried with 1.64.0. Same mistake.