Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free function kernel compilation in MLIR compilation mode #250

Closed
amccaskey opened this issue Jun 13, 2023 · 1 comment
Closed

Free function kernel compilation in MLIR compilation mode #250

amccaskey opened this issue Jun 13, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@amccaskey
Copy link
Collaborator

__qpu__ void super() {
  cudaq::qreg q(1);
  h(q[0]);
  mz(q[0]);
}

int main() {
  cudaq::sample(super).dump();
}
nvq++ --target quantinuum -v test.cpp
/opt/llvm/bin/clang++ -DNVQPP_TARGET_BACKEND_CONFIG="quantinuum;emulate;false" -o nvqppGenTargetBackend.N5OPvb.o -c -x c++ /workspaces/cuda-quantum/builds/gcc-12-debug/targets/backendConfig.cpp
/workspaces/cuda-quantum/builds/gcc-12-debug/bin/cudaq-quake --emit-llvm-file ../scratch/test.cpp -o test.qke
/workspaces/cuda-quantum/builds/gcc-12-debug/bin/cudaq-opt --pass-pipeline=builtin.module(canonicalize,lambda-lifting,canonicalize,apply-op-specialization,kernel-execution,inline{default-pipeline=func.func(indirect-to-direct-calls)},func.func(quake-add-metadata),device-code-loader{use-quake=1},expand-measurements,func.func(lower-to-cfg),canonicalize,cse) test.qke -o test.qke.tBJe2t
/workspaces/cuda-quantum/builds/gcc-12-debug/bin/cudaq-translate --convert-to=qir test.qke.tBJe2t -o test.ll.vKo44X
/workspaces/cuda-quantum/builds/gcc-12-debug/bin/fixup-linkage.pl test.qke test.ll
/opt/llvm/bin/llc --relocation-model=pic --filetype=obj -O2 test.ll.vKo44X -o test.qke.o
/opt/llvm/bin/llc --relocation-model=pic --filetype=obj -O2 test.ll -o test.classic.o
/opt/llvm/bin/clang++ -L/workspaces/cuda-quantum/builds/gcc-12-debug/lib -L/workspaces/cuda-quantum/builds/gcc-12-debug/lib/plugins -L/usr/lib/gcc/x86_64-linux-gnu/12 -L/usr/lib/x86_64-linux-gnu -L/usr/lib -L/lib/x86_64-linux-gnu -L/lib -L/usr/local/gdrcopy/lib64 -L/usr/local/cuda/lib64/stubs -r test.qke.o test.classic.o nvqppGenTargetBackend.N5OPvb.o -o test.o
/usr/bin/ld: test.classic.o: in function `super()':
test.cpp:(.text+0x0): multiple definition of `super()'; test.qke.o:LLVMDialectModule:(.text+0x80): first defined here
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
failed: "/opt/llvm/bin/clang++ -L/workspaces/cuda-quantum/builds/gcc-12-debug/lib -L/workspaces/cuda-quantum/builds/gcc-12-debug/lib/plugins -L/usr/lib/gcc/x86_64-linux-gnu/12 -L/usr/lib/x86_64-linux-gnu -L/usr/lib -L/lib/x86_64-linux-gnu -L/lib -L/usr/local/gdrcopy/lib64 -L/usr/local/cuda/lib64/stubs -r test.qke.o test.classic.o nvqppGenTargetBackend.N5OPvb.o -o test.o"
@amccaskey amccaskey added the bug Something isn't working label Jun 13, 2023
@schweitzpgi
Copy link
Collaborator

Working on it.

schweitzpgi added a commit to schweitzpgi/cuda-quantum that referenced this issue Jun 15, 2023
schweitzpgi added a commit to schweitzpgi/cuda-quantum that referenced this issue Jun 20, 2023
schweitzpgi added a commit to schweitzpgi/cuda-quantum that referenced this issue Jun 20, 2023
schweitzpgi added a commit to schweitzpgi/cuda-quantum that referenced this issue Jun 20, 2023
MarkusPfundstein pushed a commit to fermioniq/cuda-quantum that referenced this issue Sep 23, 2024
* Fix NVIDIA#250: linkage of top-level (global) function.

Needed a little persuasion.

* Fix test. Increase the sampling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants