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

最小限の実装で試す MetalによるGPUコンピューティング

1ae8fc4f63ab4770dd4545006489234c?s=47 yuky_az
February 15, 2017

最小限の実装で試す MetalによるGPUコンピューティング

potatotips #37 (iOS/Android開発Tips共有会)での発表に用いたスライドです。

1ae8fc4f63ab4770dd4545006489234c?s=128

yuky_az

February 15, 2017
Tweet

Transcript

  1. ࠷খݶͷ࣮૷Ͱࢼ͢ .FUBMʹΑΔ(16ίϯϐϡʔςΟϯά :VLJOBHB"[VNB !ZVLZ@B[ QPUBUPUJQT

  2. ࣗݾ঺հ :VLJOBHB"[VNB
 ʢզ࠺޾௕ʣ J04ΤϯδχΞϓϩάϥϛϯάΠϯετϥΫλʔ !ZVLZ@B[ J0%$Ͱ͸εϚϗ޲͚73ΞϓϦͷ։ൃʹ͍ͭͯൃද 6EFNZͰʮΈΜͳͷ"*ߨ࠲ʯ։ߨத

  3. Metalͱ͸ʁ Φʔόʔϔουͷখ͍͞ϩʔϨϕϧͳ ίϯϐϡʔλάϥϑΟοΫε"1* 0QFO(-ͱ0QFO$-ʹࣅͨػೳΛҰͭͷ"1*ʹ౷߹

  4. ࠓճͷൃද಺༰ 1. ඳըॲཧ 2. ฒྻԋࢉ MetalʹΑΔ

  5. GPUฒྻԋࢉͱ͸ʁ GPUͷԋࢉϦιʔεΛը૾ॲཧҎ֎ʹར༻

  6. CPUͱGPUͷ࿈ܞ EFWFMPQFSBQQMFDPNNFUBM

  7. Metal CPUଆͷొ৔ਓ෺ 1 .5-%FWJDF୯Ұͷ(16ͷΠϯλʔϑΣΠε .FUBMؔ࿈ͷ"1*͸ଟ͕͘ϓϩτίϧͰهࡌ EFWJDF.5-$SFBUF4ZTUFN%FGBVMU%FWJDF  QSJOUEFWJDFOBNF"QQMF"(16

  8. Metal CPUଆͷొ৔ਓ෺ 2 .5--JCSBSZγΣʔμʔ΁ͷΠϯλʔϑΣΠε .5-'VODUJPO.FUBM4IBEJOH-BOHVBHFͰॻ͔Εͨؔ਺ .5-$PNQVUF1JQFMJOF4UBUF.5-'VODUJPOΛίϯύΠϧ͞Εͨίʔυʹม׵ .5-$PNQVUF$PNNBOE&ODPEFSίϚϯυΛ(16༻ʹΤϯίʔυ .5-$PNNBOE#V⒎FS(16Ͱ࣮ߦ͞ΕΔίϚϯυΛ֨ೲ .5-$PNNBOE2VFVF্هͷΩϡʔɺίϚϯυͷ࣮ߦॱΛ؅ཧ .5-%FWJDF

    ੜ੒
  9. Metal Shading Language JODMVEFNFUBM@TUEMJC VTJOHOBNFTQBDFNFUBM LFSOFMWPJEBEE0OF DPOTUEFWJDFqPBU JOQVU%BUB<<CV⒎FS  >>

     EFWJDFqPBU PVUQVU%BUB<<CV⒎FS  >>  VJOUJE<<UISFBE@QPTJUJPO@JO@HSJE>>  \ qPBUSFTVMUJOQVU%BUB<JE> SFTVMU G PVUQVU%BUB<JE>SFTVMU ^
  10. GPU vs CPU ɾೖྗʹΛ଍ͯ͠Ҿ͘Λ܁Γฦ͢ ɾ$16ଆͰ͸ɺ্هΛສY/ճ ɾ(16ଆͰ͸ສεϨουY/ճ LFSOFMWPJEBEE"OE4VCUSBDU DPOTUEFWJDFqPBU JOQVU%BUB<<CV⒎FS 

    >>  EFWJDFqPBU PVUQVU%BUB<<CV⒎FS  >>  VJOUJE<<UISFBE@QPTJUJPO@JO@HSJE>>  \ qPBUSFTVMUJOQVU%BUB<JE> GPS VJOUJJ/J \ SFTVMU G SFTVMUG ^ PVUQVU%BUB<JE>SFTVMU ^
  11. CPU vs GPU ഒఔ౓

  12. CPU vs GPU ʢର਺ʣ $16(16ؒͷ΍ΓͱΓΛ࠷খݶʹ͢Δ͜ͱ͕େࣄ

  13. ࣮૷ํ๏ɺಛੑ͕෼͔͖ͬͯͨͱ͜ΖͰ Կ͔Ԡ༻ͯ͠ΈΑ͏ʂ

  14. ܈஌ೳͱ͸ʁ ਓ޻஌ೳͷҰछɺूஂͱͯ͠ߴ౓ͳৼΔ෣͍

  15. ܈Εͷ3ͭͷϧʔϧ B౳ڑ཭֤ݸମ͕౳ڑ཭ΛอͭΑ͏ʹಈ͘ Cฒߦ֤ݸମ͕ଞͷݸମͱಉ͡޲͖ʹͳΔΑ͏ʹಈ͘ D౳଎֤ݸମ͸ଞͷݸମͱಉ͡଎౓ʹͳΔΑ͏ʹಈ͘

  16. ਺ࣜԽ B౳ڑ཭ Cฒߦ D౳଎౓

  17. γΣʔμʔͷίʔυ LFSOFMWPJENPWF ʜ GPS VJOUJJOPEF$PVOUJ \ ʜ ౳ڑ཭ qPBUBUUSBDUJPOFYQ C

     EJTUBODFB EJTUBODFB  qPBUSFQVMTJPOFYQ C EJTUBODF EJTUBODF  E"OHMF BMQIB  OFBS"OHMF BUUSBDUJPO GBS"OHMF SFQVMTJPO JOUFSWBM ฒߦ qPBUQBSBMMFM"OHMF%JGHFU3BOHFE"OHMF OPEFBOHMFDVSSFOU/PEFBOHMF  E"OHMF CFUB QBSBMMFM"OHMF%JG FYQ C EJTUBODF EJTUBODF  JOUFSWBM ౳଎౓ qPBUOPEF7FMPDJUZTRSU OPEFWFMPDJUZ9 OPEFWFMPDJUZ9 OPEFWFMPDJUZ: OPEFWFMPDJUZ:  WFMPDJUZ HBNNB  OPEF7FMPDJUZWFMPDJUZ  FYQ C EJTUBODF EJTUBODF  ^
  18. ߏ੒ ʢ6**NBHF7JFXͷαϒΫϥεʣ 7JFX$POUSPMMFSTXJGU .FUBM.BOBHFSTXJGU 4IBEFSNFUBM

  19. ࣮ԋ case1 IUUQTZPVUVCFD"60+XNF6" ЋЌ—Ѝ

  20. ࣮ԋ case2 IUUQTZPVUVCF(KES:&3:,7D ЋЌЍ

  21. ࣮ԋ case3 IUUQTZPVUVCF8M.J+%[$G ЋЌЍ

  22. ύϑΥʔϚϯεʹ͍ͭͯ ͷݸମΛ࢖༻ɺͦΕͧΕͷ૬ޓ࡞༻Λߟ͑ͨͷͰ YͰճͷԋࢉΛຖϑϨʔϜ͝ͱ ඵؒʹճ࣮ߦ GQTΛΩʔϓɺ$16઎༗཰ఔ౓ FYQؔ਺͚ͩͰສճඵʢʣ

  23. ·ͱΊ ຊ೔ͷൃද಺༰ɺৄࡉ͸2JJUBͰ .FUBMͰϋΠύϑΥʔϚϯεͳ(16ฒྻԋࢉ͕Մೳ ෳࡶͳݱ৅ΛJ1IPOF಺ʹ࠶ݱͰ͖Δ ਓ޻஌ೳͳͲ΁ͷԠ༻ɺظ଴େ IUUQRJJUBDPNZVLZ@B[

  24. ͯͯ͘͘ษڧձ #tekutekustudy ҟۀछΤϯδχΞ͕ू·Δษڧձ

  25. Metal Advent Calendar

  26. ιʔείʔυ HJUIVCDPNZVLJOBHB4XBSN*OUFMMJHFODF