[llvm-dev] ScaffCC (A Framework for Compilation and Analysis of Quantum Computing Programs) migrated to LLVM 6.0 (original) (raw)
Leslie Zhai via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 2 21:48:31 PDT 2017
- Previous message: [llvm-dev] ScaffCC (A Framework for Compilation and Analysis of Quantum Computing Programs) migrated to LLVM 6.0
- Next message: [llvm-dev] slides from the LLVM October Meeting?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ali JavadiAbhari, Shruti Patil, Daniel Kudrow, Jeff Heckey, Alexey Lvov, Frederic Chong and Margaret Martonosi, ScaffCC: A Framework for Compilation and Analysis of Quantum Computing Programs, ACM International Conference on Computing Frontiers (CF 2014), Cagliari, Italy, May 2014
在 2017年11月03日 12:24, Leslie Zhai 写道: > Hi ScaffCC and LLVM developers, >> My sincere thanks goto: >> * Yupan Liu https://github.com/climberpi he introduced ScaffCC to me, > and he wrote some popular science introduce about quantum computing > https://www.zhihu.com/people/climberpi/activities >> * Ali JavadiAbhari https://github.com/ajavadia he is the core > developer of ScaffCC, count (ajavadia + epiqc) contribution together > :) https://github.com/epiqc/ScaffCC/graphs/contributors >> * Adam Holmes https://github.com/ah744 he is also core developer and > provided kind response to ScaffCC users recently > https://github.com/epiqc/ScaffCC/issues/7#issuecomment-336499375 >> * Hal Finkel https://www.alcf.anl.gov/staff-directory/hal-finkel he > taught me how to use Internalize and GlobalDCE PASS correctly but not > monkey patch > http://lists.llvm.org/pipermail/llvm-dev/2017-October/118495.html >> * Michael Kruse https://github.com/Meinersbur he taught me how to > workaround use LoopUnroll PASS > http://lists.llvm.org/pipermail/llvm-dev/2017-October/118420.html >> and others who give me kind responses for teaching me about qubit and > quantum gate https://en.wikipedia.org/wiki/Quantumgate >>> ScaffCC has been migrated to LLVM 6.0 https://github.com/ScaffCC and > it is just able to simulate qubit and quantum gate now, for example: >> $ cat catstate.n04.scaffold (Scaffold is a high level, C-like > programming language for expressing quantum algorithms) > qmodule catN(qbit *bit, const int n) { > H(bit[0]); > _for (int i = 1; i < n; i++) {_ > CNOT(bit[i], bit[i - 1]); > } > } >> qmodule unCatN(qbit *bit, const int n) { > for (int i = n - 1; i > 0; i--) { > CNOT(bit[i], bit[i - 1]); > } > H(bit[0]); > } >> int main() { > qbit bits[4]; > catN(bits, 4); > return 0; > } >> $ ./scaffold.sh -fkR Algorithms/CatState/catstate.n04.scaffold (a > easy to use helper shell script for clang and opt command) > [Scaffold.makefile] Compiling catstate.n04merged.scaffold ... > clang version 6.0.0 (git at github.com:llvm-mirror/clang.git > b4d187902f12e2f8240beb2b50227db637a6d5ba) > (git at github.com:llvm-mirror/llvm.git > 2653dfaeb3502fd81dc99fde001be69d62a67d13) > Target: x8664-unknown-linux-gnu > Thread model: posix > InstalledDir: /data/project/ScaffCC/ScaffCC/./build/bin > Found candidate GCC installation: /usr/lib/gcc/x8664-redhat-linux/6.3.1 > Found candidate GCC installation: /usr/lib/gcc/x8664-redhat-linux/6.4.1 > Selected GCC installation: /usr/lib/gcc/x8664-redhat-linux/6.4.1 > Candidate multilib: .;@m64 > Candidate multilib: 32;@m32 > Selected multilib: .;@m64 > Found CUDA installation: /usr/local/cuda, version 9.0 > "/data/project/ScaffCC/ScaffCC/build/bin/clang-6.0" -cc1 -triple > x8664-unknown-linux-gnu -emit-llvm -disable-free -main-file-name > catstate.n04merged.scaffold -mrelocation-model static -mthread-model > posix -mdisable-fp-elim -fmath-errno -masm-verbose > -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu > x86-64 -dwarf-column-info -debugger-tuning=gdb -v -coverage-notes-file > /data/project/ScaffCC/ScaffCC/catstate.n04.gcno -resource-dir > /data/project/ScaffCC/ScaffCC/build/lib/clang/6.0.0 -I > Algorithms/CatState/ -internal-isystem /usr/local/include > -internal-isystem > /data/project/ScaffCC/ScaffCC/build/lib/clang/6.0.0/include > -internal-externc-isystem /include -internal-externc-isystem > /usr/include -fdebug-compilation-dir /data/project/ScaffCC/ScaffCC > -ferror-limit 19 -fmessage-length 103 -fobjc-runtime=gcc > -fdiagnostics-show-option -fcolor-diagnostics -disable-O0-optnone -o > catstate.n04.ll -x c catstate.n04merged.scaffold > clang -cc1 version 6.0.0 based upon LLVM 6.0.0svn default target > x8664-unknown-linux-gnu > ignoring nonexistent directory "/include" > #include "..." search starts here: > #include <...> search starts here: > Algorithms/CatState > /usr/local/include > /data/project/ScaffCC/ScaffCC/build/lib/clang/6.0.0/include > /usr/include > End of search list. > [Scaffold.makefile] Transforming cbits ... > [Scaffold.makefile] O1 optimizations ... > [Scaffold.makefile] Unrolling Loops (1) ... > [Scaffold.makefile] Cloning Functions (1) ... > Functions Cloned: 1 > [Scaffold.makefile] Dead Argument Elimination (1) ... > [Scaffold.makefile] Unrolling Loops (2) ... > [Scaffold.makefile] Cloning Functions (2) ... > Functions Cloned: 0 > [Scaffold.makefile] Dead Argument Elimination (2) ... > [Scaffold.makefile] Unrolling Loops (3) ... > [Scaffold.makefile] Cloning Functions (3) ... > Functions Cloned: 0 > [Scaffold.makefile] Dead Argument Elimination (3) ... > [Scaffold.makefile] Internalizing and Removing Unused Functions ... > [Scaffold.makefile] Toffoli Decomposition ... > [Scaffold.makefile] Inserting Reverse Functions... > [Scaffold.makefile] Flattening modules ... > [Scaffold.makefile] Flat QASM written to catstate.n04.qasmf ... >> $ cat catstate.n04.qasmf > qubit bits0 > qubit bits1 > qubit bits2 > qubit bits3 > H bits0 > CNOT bits1,bits0 > CNOT bits2,bits1 > CNOT bits3,bits2 >> $ ./catstate.n04qasm > H bits0 > CNOT bits1,bits0 > CNOT bits2,bits1 > CNOT bits3,bits2 >> $ ./scaffold.sh -s Algorithms/CatState/catstate.n04.scaffold > $ ./qxsimulator1.0.betalinuxx8664 catstate.n04.qc >> ======================================================================================================= >> _____ > / _ \ _ __ __ _ _ _ _ _ __ > ____ __ __ > / / / | | |// / / / / / |/ / / / / / / / / | > / / / _ \ / _ > / // / > < \ \ / / / /|/ / / // / / /_ / __ > | / / / // / / , / > ___/_\ //|| // // // // _/ /__/// > || // _/ //|| > [v0.1 beta] > _____________________________________________________ >> [version 0.1 beta - Nader Khammassi - TU Delft, QuTech - 2016 -_ > _report bugs to: n.khammassi at tudelft.nl] > [released under Apache License 2.0 terms, license copy at:_ > _http://www.apache.org/licenses/LICENSE-2.0] > ======================================================================================================= >>> [+] loading circuit from 'catstate.n04.qc' ... > [-] loading quantumcode file 'catstate.n04.qc'... > [+] code loaded successfully. > [+] initializing xpu... > [+] initialized. > [+] creating quantum register of 4 qubits... > [+] executing circuit 'default' (1 iter) ... > --------------[quantum state]-------------- > (+0.707107,+0.000000) |0000> + > (+0.707107,+0.000000) |1111> + > ------------------------------------------- > [>>] measurement prediction: | X | X | X | X | > ------------------------------------------- > [>>] measurement register : | 0 | 0 | 0 | 0 | > ------------------------------------------- > [+] circuit execution time: +0.000396 sec. >> QX: Quantum Computer Simulator > https://qutech.nl/qx-quantum-computer-simulator/ >>> About HACKING ScaffCC, just git checkout scaff-llvm release31 branch > https://github.com/ScaffCC/scaff-llvm/tree/release31 >> Then >> $ git diff 02b87df98afb03136a1f5076c042696c98524947 >> to see how ScaffCC modified the original LLVM release31 branch, so it > is able to: >> * Add more quantum types > https://github.com/ScaffCC/scaff-llvm/blob/master/include/llvm/IR/Intrinsics.td#L254 >> * Add more quantum gates > https://github.com/ScaffCC/scaff-llvm/blob/master/include/llvm/IR/Intrinsics.td#L313 >> * Optimize Scaffold PASS > https://github.com/ScaffCC/scaff-llvm/tree/master/lib/Transforms/Scaffold >> Also checkout scaff-clang release31 branch > https://github.com/ScaffCC/scaff-clang/tree/release31 to diff >>> WIP: >> Quantum algorithm Shors > https://github.com/ScaffCC/ScaffCC/tree/master/Algorithms/Shors is too > heavy! it used up classical computer (my Thinkpad X220 notebook) > resource https://github.com/ScaffCC/ScaffCC/issues/3 it needs to > optimize Scaffold and LLVM PASS. >
Regards, Leslie Zhai - https://reviews.llvm.org/p/xiangzhai/
- Previous message: [llvm-dev] ScaffCC (A Framework for Compilation and Analysis of Quantum Computing Programs) migrated to LLVM 6.0
- Next message: [llvm-dev] slides from the LLVM October Meeting?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]