Upgrade to Pro — share decks privately, control downloads, hide ads and more …

音の出るCPUを作っている途中

KOBA789
March 20, 2021

 音の出るCPUを作っている途中

2021/03/20の「Kernel/VM探検隊online part2」で発表したものです。
https://connpass.com/event/201059/
https://www.youtube.com/watch?v=brrm328XItM&t=2621s

KOBA789

March 20, 2021
Tweet

More Decks by KOBA789

Other Decks in Technology

Transcript

  1. KOBA789
    Իͷग़ΔCPU
    Λ࡞͍ͬͯΔ్த

    View full-size slide

  2. ·ͣ༧๷ઢΛுΒͤͯ͘Εʂ


    ͜Ε͸ٳܜλΠϜͩʂʂʂʂʂ

    View full-size slide

  3. KOBA789
    • ύιίϯΦλΫ

    • ࠷ऴֶྺߴଔ

    • ݱࡏແ৬ʢਓੜͷय़ٳΈʣ

    • ࣗ࡞ DBMS ੎
    Ͱɺ୭ʁ

    View full-size slide

  4. https://diary.hatenablog.jp/entry/2020/11/16/222203

    View full-size slide

  5. ࣗ࡞DBMSͷ࿩͸͠·ͤΜ

    View full-size slide

  6. CPUͷ࿩΋͠·ͤΜ

    View full-size slide

  7. ࠓ೔ͷ಺༰
    • ʢͳΜΒ͔ͷʣγϛϡϨʔλͷ࿩

    • WebAssemblyʢΛ࢖͏ଆʣͷ࿩

    • WebGL ͷ࿩

    • Rust ͷ࿩
    ͥΜͿଞͷొஃऀ͕ৄ͘͠

    ஻ͬͯ͘ΕΔΜ͡Όͳ͍͔ʁ

    View full-size slide

  8. ۙ೥ࣗ࡞ CPU ͕Ξπ͍ CPUΛࣗ࡞ͨ͜͠ͱ͕͋Γ·͔͢
    50% 50%
    ͸͍ ͜Ε͔Β࡞Δ
    ※׬શͳໝ૝ͱओ؍ʹجͮ͘σʔλ
    Զ΋࡞Γ͍ͨ

    View full-size slide

  9. ʮCPU ͷݪྉͬͯγϦίϯͳΜͰ͢Αʂɹ
    ҙ֎ʹ͜Ε஌ΒΕͯͳ͍ΜͰ͚͢Ͳʯ

    View full-size slide

  10. ʮCPU ͷݪྉͬͯγϦίϯͳΜͰ͢Αʂɹ
    ҙ֎ʹ͜Ε஌ΒΕͯͳ͍ΜͰ͚͢Ͳʯ
    ৗࣝ

    View full-size slide

  11. ʮCPU ͷݪྉͬͯγϦίϯͳΜͰ͢Αʂɹ
    ҙ֎ʹ͜Ε஌ΒΕͯͳ͍ΜͰ͚͢Ͳʯ
    ৗࣝ
    ͸ͨͯ͠

    ͦ͏ͩΖ͏͔

    View full-size slide

  12. CPU͸൒ಋମҎ֎Ͱ΋࡞ΕΔ
    ࿦ཧճ࿏Λߏ੒Ͱ͖Ε͹

    ૉࢠ͸ͳΜͰ΋͍͍
    ͔ͷ༗໊ͳ&/*"$͸ਅۭ؅

    View full-size slide

  13. ͦ΋ͦ΋
    ൒ಋମͰ࡞ͬͨ$16͸

    ಈ͍͍ͯΔͷ͔Ͳ͏͔Α͘Θ͔Βͳ͍
    େࣄͳܭࢉΛ͍ͯ͠Δͷʹ

    ౒ྗ͕ײ͡ΒΕͣɺ͚͔͠ΒΜ

    View full-size slide

  14. ͜͜ʹɺ

    খֶੜͷͱ͖ʹळ݄Ͱങͬͨ

    ϦϨʔ͕ݸ͋Δ

    View full-size slide

  15. ͜ͷϦϨʔͰ$16Λ࡞Ζ͏

    View full-size slide

  16. ϦϨʔͱ͸
    ి࣓ੴͰమ൘͕

    ٵ͍دͤΒΕΔ

    ૉ๿ͳ࢓૊Έ
    εΠονϯάૉࢠͷͻͱͭ

    View full-size slide

  17. ϦϨʔͱ͸
    ෺ཧతͳՄಈ෦͕͋ΔͷͰ

    ಈ࡞Ի͕͢Δ
    ָ͍͠ʂʂ

    View full-size slide

  18. ϦϨʔಛ༗ͷࠔΓ͝ͱ
    • ௨ৗͷ࿦ཧճ࿏΄Ͳ஌ݟ͕ڞ༗͞Ε͍ͯͳ͍

    • ࿦ཧѹॖͷίπͱ͔Θ͔Βͳ͍

    • ։ൃʹศརͳπʔϧͳͲ΋ϩΫʹͳ͍

    • γϛϡϨʔλͱ͔ͳ͍

    • ͕Μ͹ͬͯϋϯμ෇͚ͯ͠ಈ͔ͳ͔ͬͨΒͱͯ΋൵͍͠

    View full-size slide

  19. ·ͣ͸ճ࿏$"%Λ࡞Ζ͏ʂ
    $"%Λ࡞Δͷָ͕ͯ͘͠$16Λ࡞ΔͷΛ๨Εͨ

    View full-size slide

  20. ͜͜Ͱࢥ͍ग़͢γϦʔζ

    View full-size slide

  21. https://www.youtube.com/watch?v=KiHpyP5UhyE

    View full-size slide

  22. ೥લʹ΋ಉ͡Α͏ͳൃදΛ͍ͯ͠Δ
    https://www.youtube.com/watch?v=KiHpyP5UhyE

    View full-size slide

  23. https://www.youtube.com/watch?v=jYJ31SrxCEE

    View full-size slide

  24. https://www.youtube.com/watch?v=jYJ31SrxCEE
    ཌ೥ʹ΋ಉ͡Α͏ͳ

    ൃදΛ͍ͯ͠Δʂʂ

    View full-size slide

  25. ࡾ౓໨ͷਖ਼௚

    View full-size slide

  26. ࠓճ͸࢖͍ͮΒ͍

    γϛϡϨʔλ͚ͩͰͳ͘ɺ

    $"%΋࡞ͬͨ

    View full-size slide

  27. ͓඼ॻ͖
    • γϛϡϨʔλΛ࡞Δ

    • Ͳ͏΍ͬͯϦϨʔճ࿏ͷγϛϡϨʔγϣϯΛ͢Δ͔

    • CADΛ࡞Δ

    • ճ࿏CADΛ60fpsͰψϧψϧಈ͔͢

    • Rust, WebAssembly, WebGL……

    • σϞ
    CPU࡞Δͱ͜Ζ·Ͱ͸

    ؒʹ߹Θͳ͔ͬͨͶ

    View full-size slide

  28. γϛϡϨʔλΛ࡞Δ

    View full-size slide

  29. ి࣓ϦϨʔͷճ࿏
    • ίΠϧͱ઀఺Λͭͳ͍Ͱ࡞Δ

    • ίΠϧͷยଆ͸ඞͣGNDʹ͢Δ

    • ઈରʹγϣʔτ͠ͳ͘ͳΔ

    • γϛϡϨʔλ΋࡞Γ΍͍͢
    ίΠϧ ઀఺

    View full-size slide

  30. ి࣓ϦϨʔͷճ࿏
    • ճ࿏

    • ͭ·Γάϥϑ

    • ిؾ͕ྲྀΕΔ

    • ͭ·Γ࿈݁੒෼

    View full-size slide

  31. ి࣓ϦϨʔͷճ࿏
    ࿈݁੒෼ʹ

    ిݯ͕͋Δ͔

    View full-size slide

  32. ͱ͍͏Α͏ͳ͜ͱΛRustͰద౰ʹॻ͘

    View full-size slide

  33. CADʹٻΊΔ΋ͷ
    • ॻ͍ͨճ࿏ਤ͕ͦͷ··ಈ͍ͯ΄͍͠

    • ಈ͘ճ࿏ਤΛ௚઀৮ͬͯ༡ͼ͍ͨ

    • ڊେͳճ࿏ਤͰ΋60fpsͰψϧψϧಈ͍ͯཉ͍͠

    • ճ࿏ن໛͕େ͖͘ͳͬͯ΋γϛϡϨʔγϣϯ͸ͳΊΒ͔ʹ

    View full-size slide

  34. ΠϚυΩͷGUIͱ͍͑͹ϒϥ΢β
    ReactͱTypeScriptͰόʔϯͩͥʁ
    • ཁૉ਺͕૿͑ͯ͘ΔͱDOMͰ͸஗͗͢Δ

    • TypeScript(JavaScript)Ͱ࠲ඪܭࢉΛ͠·͘ΔίʔυΛॻ͘ͷ͸

    ͋·ΓʹΩπ͍

    • ԋࢉࢠͷΦʔόʔϩʔυ͕ͳ͍ͷͰඇৗʹ໨ʹѱ͍ίʔυʹ

    • ͋ͱɺ΍ͬͺ஗͍

    View full-size slide

  35. RustͰ

    WebAssemblyͰ

    WebGLͩʂ

    View full-size slide

  36. WebGLͱ͸
    ߴϨΠϠͳͷͰҰԠ
    • JavaScript͔ΒOpenGLͷΑ͏ͳ΋ͷ͕ୟ͚ΔAPI

    • ༨ܭͳ΋ͷ͕ʢൺֱతগͳ͘ʣ଎͍

    • ΄΅OpenGL͕ͦͷ··࿐ग़͍ͯ͠Δ

    • JSͷΑ͏ͳεΫϦϓτݴޠͱͷ૬ੑ͸࠷ѱ

    • ͜ΕΛJSͰ࢖͏ਓ͸͔ͳΓ೜଱ྗ͕͋Δ

    • RustͰ࢖͏΂͖

    View full-size slide

  37. WebGL(OpenGL)Ͱ2DάϥϑΟοΫε
    • OpenGLͰ͸͝ଘ͡ͷͱ͓Γࡾ֯ܗ͔͠ॻ͚ͳ͍

    • ԁʁͱ͔ॻ͚ͳ͍

    • ઢ෼΋ࡾ֯ܗΛ2ຕ࢖͏

    • จࣈ΋ॻ͚ͳ͍

    • ؾ߹͍Ͱશ෦࣮૷͢Δ

    • 60fpsͷͨΊͱࢥ͑͹ͭΒ͘ͳ͍

    View full-size slide

  38. Immediate mode GUI
    • εςʔτϨεͰɺຖϑϨʔϜશ෦ඳ͖௚͢

    • ϏοτϚοϓΛࠩ෼Ͱ࢖͍ճͨ͠Γ͠ͳ͍

    • ήʔϜΤϯδϯͳͲͱ૬ੑͷ͍͍GUIΞʔΩςΫνϟ

    • Dear ImGui΍UnityͷIMGUI͕༗໊

    • ࠓճͷCADͰ΋͜ΕΛ࠾༻

    View full-size slide

  39. ຖϑϨʔϜඳ͍ͨΒ஗͘ͳ͍ͷ͔
    • ݱ୅ͷGPUࣗମ͸௒଎͍

    • GPU͸CPU͔ΒRPCͰૢ࡞͢Δ

    • RPCͷίϚϯυൃߦ͕࣌ؒ৯͏

    • ίϚϯυ਺Λ࡟Ε͹Ξϗ΄Ͳ଎͍

    • ͍Ζ͍ΖςΫ͕͋Δ

    View full-size slide

  40. ࠓޙͷເ
    • subleqͷΑ͏ͳʢ໋ྩηοτ͕ʣখ͍͞ΞʔΩςΫνϟΛ࣮૷ͯ͠Έ͍ͨ

    • ωοτϦετ͸ు͚ΔΑ͏ʹͨ͠ͷͰɺ

    ϓϦϯτج൘ͷΞʔτϫʔΫΛ͓࣮ͯ͜͠ػΛ࡞Γ͍ͨ

    View full-size slide