XiangShan (शांगशान) – ओपन-सोर्स हाई-परफॉर्मेंस RISC-V प्रोसेसर
(github.com/OpenXiangShan)- XiangShan(香山) एक ओपन-सोर्स प्रोजेक्ट है जिसका लक्ष्य हाई-परफॉर्मेंस RISC-V प्रोसेसर बनाना है, और मौजूदा वर्ज़न Kunminghu(昆明湖) master ब्रांच पर डेवलप हो रहा है
- डॉक्यूमेंटेशन docs.xiangshan.cc पर उपलब्ध है, और Kunminghu V2R2 डिज़ाइन डॉक्यूमेंट व यूज़र गाइड अलग-अलग डॉक्यूमेंट के रूप में दिए गए हैं
- स्थिर माइक्रोआर्किटेक्चर में Yanqihu(雁栖湖) और Nanhu(南湖) शामिल हैं; Yanqihu पहला स्थिर माइक्रोआर्किटेक्चर है जिसका डेवलपमेंट जून 2020 से शुरू हुआ
- डेवलपमेंट फ्लो Scala डिज़ाइन कोड, FIRRTL transformation, cache subsystem, difftest co-simulation framework, और pre-built simulation images से बना है
- Verilog generation, Verilator-आधारित simulator execution, और xspdb run path उपलब्ध हैं, ताकि design generation और program simulation प्रोजेक्ट के अंदर ही किए जा सकें
प्रोजेक्ट ओवरव्यू
- XiangShan(香山) एक ओपन-सोर्स हाई-परफॉर्मेंस RISC-V processor प्रोजेक्ट है
- चीनी विवरण अलग README के रूप में उपलब्ध है
- प्रोजेक्ट डॉक्यूमेंटेशन docs.xiangshan.cc पर देखा जा सकता है
- Kunminghu V2R2 के लिए XiangShan design document अलग से docs.xiangshan.cc/projects/design पर प्रकाशित है
- XiangShan user guide docs.xiangshan.cc/projects/user-guide और XiangShan-User-Guide/releases पर उपलब्ध है
- डॉक्यूमेंटेशन translation के लिए Weblate का उपयोग किया जाता है, और English व अन्य भाषाओं के translation योगदान स्वीकार किए जाते हैं
- सभी XiangShan डॉक्यूमेंट CC-BY-4.0 लाइसेंस के तहत हैं
प्रकाशित पेपर और डेवलपमेंट मेथडोलॉजी
- MICRO 2022 पेपर “Towards Developing High Performance RISC-V Processors Using Agile Methodology” XiangShan और हाई-परफॉर्मेंस RISC-V processors के development में agile development methodology के उपयोग पर केंद्रित है
- पेपर chip development process को तेज़ करने के लिए डेवलप और उपयोग किए गए tools को कवर करता है
- Design
- Functional verification
- Debugging
- Performance verification
- इस पेपर को artifact evaluation में Available, Functional, Reproduced तीनों badges मिले
- Resources links:
माइक्रोआर्किटेक्चर वर्ज़न
- पहला stable microarchitecture Yanqihu(雁栖湖) है, जो yanqihu branch में है
- इसका development जून 2020 से हुआ
- दूसरा stable microarchitecture Nanhu(南湖) है, जो nanhu branch में है
- मौजूदा वर्ज़न को Kunminghu(昆明湖) भी कहा जाता है, और यह अभी master branch पर development में है
- README में Kunminghu microarchitecture overview diagram शामिल है
Repository structure
- मुख्य directories design code, development scripts, submodules, cache, co-simulation, और execution images में बंटी हैं
src/main/scala: design files का स्थानdevice: simulation के लिए virtual devicessystem: SoC wrappertop: top-level moduleutils: utility codexiangshan: मुख्य design codexiangshan/transforms: उपयोगी FIRRTL transformations
scripts: agile development के लिए scriptsyunsuan: XiangShan का yunsuan submoduleXSCache: XiangShan का cache subsystemdifftest: difftest co-simulation frameworkready-to-run: pre-built simulation images
IDE और Verilog generation
- BSP setup
make bspसे किया जाता है - IDEA setup
make ideaसे किया जाता है - Verilog code
make verilogसे generate किया जाता है- कई
.svfilesbuild/rtl/folder में generate होती हैं - example file
build/rtl/XSTop.svहै - अधिक जानकारी के लिए
Makefileदेखें
- कई
Simulation execution
- किसी program को simulation में चलाने के लिए environment variables और dependent tools की ज़रूरत होती है
- तैयारी के steps:
NEMU_HOMEको NEMU project के absolute path पर set करेंNOOP_HOMEको XiangShan project के absolute path पर set करेंAM_HOMEको AM project के absolute path पर set करेंmillinstall करें- project clone करने के बाद
make initसे submodules initialize करें
- Verilator-based simulator:
- Verilator install करना ज़रूरी है
make emuसे Verilator-based C++ simulator./build/emubuild होता है- execution arguments
./build/emu --helpमें देखे जा सकते हैं - अधिक जानकारी के लिए
Makefileऔरverilator.mkदेखें
- Run examples:
make emu CONFIG=MinimalConfig EMU_THREADS=2 -j10./build/emu -b 0 -e 0 -i ./ready-to-run/coremark-2-iteration.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so
xspdb run paths
- xspdb को दो तरीकों से इस्तेमाल किया जा सकता है
- pre-built binary से जल्दी शुरुआत:
- compilation की ज़रूरत नहीं होती और standard Python environment से ही चलाया जा सकता है
- कम memory usage के साथ पूरा XiangShan experience देता है
- नवीनतम XSPdb repository Actions workflow के run summary से मिल सकता है
- source code से build:
- high-level languages support करने वाला verification tool picker install करना ज़रूरी है
make pdbसे XiangShan Python binary build करेंmake pdb-runसे XiangShan binary चलाएँ
- xspdb example interaction में binary load करना, commit PC watchpoint set करना, instruction-level step execution, PC information output, और binary termination point तक run करना शामिल है
Troubleshooting, community, license
- troubleshooting documentation Troubleshooting Guide में उपलब्ध है
- Contact channels:
- WeChat: 香山开源处理器
- Zhihu: 香山开源处理器
- Weibo: 香山开源处理器
- Mailing list: xiangshan-all@ict.ac.cn
- Mailing list archive: mail-archive.com
- implementation कई core papers से प्रेरित है, और संबंधित papers की list XiangShan documentation के Acknowledgements में है
- copyright notice में ये संस्थान शामिल हैं
- 2020-2025 Institute of Computing Technology, Chinese Academy of Sciences
- 2021-2025 Beijing Institute of Open Source Chip
- 2020-2022 Peng Cheng Laboratory
- XiangShan Mulan PSL v2 license के तहत है
1 टिप्पणियां
Hacker News की राय
अगर आप simulation करके देखना चाहते हैं, तो मेरे इस्तेमाल वाले Dockerfile से Ubuntu 24.04 आधारित environment बनाया जा सकता है
यह
OpenXiangShan/xs-envको clone करता है, tools install करता है, Verilator install करता है, XiangShan initialize करता है, DRAMsim3 build करता है,DefaultConfigemulator build करता है, औरnexus-am/apps/helloexample build करने तक जाता है64GB RAM चाहिए, और मेरे मामले में 16GB RAM में 48GB swap जोड़कर यह चला था। कुछ duplicate steps हो सकते हैं, लेकिन आखिरी बार कोशिश करने पर यही तरीका काम आया था
यह project हाल की मेरी दिलचस्पियों के साथ अजीब तरह से फिट बैठा, और पहली बार इसने दिमाग को सच में अच्छे से stimulate किया
हालांकि बहुत जल्दी सरसरी तौर पर देखने के बाद भी मुझे non-English users से काफी सहानुभूति महसूस हुई। README English-speaking users के लिए पर्याप्त रूप से friendly है, लेकिन पढ़ते हुए ऐसा लगा जैसे दिमाग में token names को लगातार बदलते हुए follow करना पड़ रहा हो, और इस process में दो बातें दिखीं
पहली, याद आया कि classic Russian literature को अंत तक क्यों नहीं पढ़ पाता: शुरुआत से ही ऐसे नामों की बाढ़ आ जाती है जो familiar names के set में नहीं होते, और cache miss की तरह रास्ता भटक जाता है
दूसरी, लगता है English-speaking users को ऐसी cultural muscle की बहुत ज़रूरत नहीं पड़ी। क्योंकि दुनिया काफी लंबे समय से English को कुछ हद तक common language की तरह इस्तेमाल करती रही है, और यह joke भी याद आया: “जो व्यक्ति सिर्फ एक भाषा जानता है, उसे क्या कहते हैं? monolingual… मज़ाक कर रहा हूं, American”
documentation और source के अंदर tokens को pre-process करने वाली public registry “मेरे जैसे Americans” maintain कर सकते हैं।
DefinitelyTypedstyle की definitions registry बहुत niche होगी, लेकिन काफी useful लगती हैhttps://structuredprocrastination.com/light/biling.php
https://github.com/OpenXiangShan/XiangShan-doc/blob/main/doc...
fused instructions की list थोड़ी अनोखी है। वैसे भी
SH{1,2,3,4}ADDसे match होने वाली चीज़ों को छोड़ दें तो बाकी की उम्मीद नहीं थीमैं Google Translate से देख रहा हूं, लेकिन SiFive-style का short jump conditional execution भी वहां नहीं दिखता
उनका tech wiki navigate और search करने में काफी मुश्किल है, और unofficial GitHub repositories भी ज्यादा बेहतर नहीं हैं, इसलिए यह पता लगाना भी मुश्किल है कि ऐसी कोई चीज़ मौजूद है या नहीं
कुछ हफ्ते पहले भी मैंने इस project का link post किया था; ऐसे academic projects देखना वाकई दिलचस्प है
जिनकी रुचि हो, उनके लिए biweekly blog यहां linked है, और कुछ posts English में भी उपलब्ध हैं: https://docs.xiangshan.cc/zh-cn/latest/blog/
microarchitecture names Yanqihu(雁栖湖), Nanhu(南湖), Kunminghu(昆明湖) जैसे lake theme पर हैं, यह अच्छा लगा
Coffee Lake? Skylake? नहीं, Kunming Lake है
https://en.m.wikipedia.org/wiki/List_of_Intel_codenames
यह ध्यान देने लायक है कि China AI, robotics, processors में बड़ी प्रगति कर रहा है, और उनमें से बहुत-सी चीज़ों को open source के रूप में जारी करना भी impressive है
शानदार काम है और प्रेरक है
Chinese culture लगातार reproduction और incremental improvement के इर्द-गिर्द बना है, और यह कम से कम Confucius के समय तक पीछे जाता है। कुछ लोग इसे अंधाधुंध copying मानते हैं, लेकिन असल में यह गहराई से सीखने और दूसरों के कंधों पर खड़े होने के ज्यादा करीब है
इस तरह का “fork करो” attitude open source के साथ काफी अच्छी तरह fit बैठता है, लेकिन intellectual property licenses या patents के लिहाज से यह स्वाभाविक रूप से परेशान करने वाला तरीका हो सकता है
हालांकि इसका मतलब यह नहीं कि यह openness China के बाहर, खासकर Chinese culture और language sphere के बाहर, आसानी से फैल जाती है
XiangShan की पिछली Nanhu architecture का इस्तेमाल करने वाला एक commercial product है। लगता है अभी launch नहीं हुआ, लेकिन फिर भी दिलचस्प है
https://milkv.io/ja/ruyibook
इसे open source के रूप में जारी करने की strategy क्या होगी?
वहां कही गई बातों में से एक यह थी कि वे चाहते हैं कि RISC-V overall, और खासकर उनके cores, academic research platform बनें। ऐसा होने पर cutting-edge ideas खुले तौर पर share होंगे और industry को globally फायदा होगा
optimistic रूप से देखें तो यह सबके लिए बेहतर future चाहने जैसा है, और cynical रूप से देखें तो open source पर sanctions या export controls लगाना कहीं ज्यादा मुश्किल है। सच शायद इन दोनों के बीच कहीं होगा
वैसे भी उससे पैसा कमाना मुश्किल है और universities आमतौर पर इसकी अनुमति देती हैं, इसलिए resume के लिए यह बहुत अच्छा होता है
Europe में भी बहुत open source है, और सच कहूं तो सरकारें America को नष्ट करने की साजिश नहीं रच रहीं। Linux को मैं Swedish government की America को नष्ट करने की योजना नहीं मानता
मेरे अनुभव में, trade business में न हों तो ज्यादातर Chinese लोग भी China के बाहर के देशों की बहुत परवाह नहीं करते। China, America जैसे देशों की तुलना में भी इतना बड़ा है कि अपने ही bubble में रहने जैसा लगता है, और वे ऐसे मुद्दों के बारे में हर महीने तो दूर, हर दिन भी नहीं सोचते लगते
यह competitors की moat पर हमला करने वाली “good enough” चीज़ मुफ्त में बांटने जैसा है। अगर gap बड़ा नहीं है तो यह competitor के business को नुकसान पहुंचा सकती है
Apple और बड़ी tech companies द्वारा Google Maps के मुकाबले OpenStreetMap को funding देना भी इसी तरह देखा जा सकता है। competitor की revenue कम करना भर भी strategic value रखता है
Satya Nadella ने interview में कहा था कि ChatGPT अगर Google search की लागत ही बढ़ा दे तो भी Microsoft के लिए यह बड़ी जीत है—यह भी उसी context में है
Chisel इस्तेमाल करने वाला एक और project देखकर अच्छा लगा। industry में direction किस तरफ जा रही है, यह जानने की उत्सुकता है
Verilog और VHDL को replace होने का समय आ गया लगता है। दोनों में से किसी एक को university में इस्तेमाल करना मुझे वाकई बहुत unpleasant लगा था
मेरे bachelor thesis supervisor एक ऐसी company चलाते हैं जो Verilog और VHDL को replace करने की कोशिश कर रही है, और 10 साल से भी काफी ज्यादा समय से कर रहे हैं। अभी तक लगता नहीं कि उसने बड़ा असर छोड़ा है, लेकिन मैं इस field को लगातार follow नहीं करता रहा: https://github.com/clash-lang/clash-compiler
इससे लिखा गया एक RISC-V implementation भी है
इस field के tools बनाना और verify करना बहुत महंगा है और market बहुत छोटा है, इसलिए किसी reasonable timeframe में existing ecosystem को threaten करने वाली चीज़ आना लगभग impossible लगता है