GPU Programming with The Metal Shading Language

  Рет қаралды 18,842

2etime

2etime

Күн бұрын

Пікірлер: 75
@CyrusPellet
@CyrusPellet 4 жыл бұрын
Awesome! Please don't stop making these, your videos are so underrated!
@pitmanra
@pitmanra 4 жыл бұрын
I'd be lying if I said I understood very much of this. But I'm interested and I'll keep watching your videos. I would find it useful if you would frequently refer your code to a chart to show what you are doing. Like a chart that shows Command Queues, Command Buffers, drawables, Render Pass Descriptors, etc. "This code is our buffer; this is how it relates to the chart." Lotta work, I know. Your enthusiasm is infectious.
@2etime
@2etime 4 жыл бұрын
Ah ok will do!
@2etime
@2etime 4 жыл бұрын
This is for you guys and if a chart helps I can do that!
@djryanashton
@djryanashton 11 ай бұрын
This is absolutely the best Metal introductory tutorial ever! I was looking for tuts to start getting my head around Metal and all of them went over my head. This didn't. Thanks. :)
@spartanrasul2260
@spartanrasul2260 4 жыл бұрын
the quality of your content become so much better. And i know that, because i was watching your videos right from the first one (and i've seen your backflip)
@swift_goose
@swift_goose 2 жыл бұрын
Bro this is an awesome video, thank you so much for taking the time. What a great introduction to Metal! Would love to see you back with more new tutorials now that Metal3 is around
@HareshKainth
@HareshKainth 4 жыл бұрын
You, sir, are a gentleman and a scholar. Thank you.
@dimiutube
@dimiutube 10 ай бұрын
Hey!! Very good explanation of the MTL basics! I like the hurry-through-the-code way of presenting. If I don’t understand something, I can stop the video at any point 😊 looking forward to the next episodes 😀
@TheZazatv
@TheZazatv 2 ай бұрын
Thank u so much! Metal is suqch lowkey framework and u explained the compute functions very well!
@AshishJain-sd2yk
@AshishJain-sd2yk 2 ай бұрын
You are awesome. Thank you for creating such a wonderful intro.
@alexnovikov1609
@alexnovikov1609 Жыл бұрын
Thank you very much! This is a really clear and good explanation about how we use GPU in Metal. Keep going! You're the best!
@elgs1980
@elgs1980 3 жыл бұрын
Thank you so much! The last time I saw such a precious video like this was about 10 years ago.
@2etime
@2etime 3 жыл бұрын
What was that video about? Lol
@Ha-ue9kg
@Ha-ue9kg 3 жыл бұрын
you fucking god. this is the best metal channel on YT.
@2etime
@2etime 3 жыл бұрын
Top 5 favorite comments
@caporazor1
@caporazor1 4 жыл бұрын
this is just a brilliant tutorial. thanks man!
@Shane-rh3wu
@Shane-rh3wu 4 жыл бұрын
This is fantastic! Thanks for sharing
@Peterrayism
@Peterrayism 4 жыл бұрын
Watching you teach is making my wave function collapse.
@2etime
@2etime 4 жыл бұрын
Is that a good thing?
@THE_ONLY_GOD
@THE_ONLY_GOD 2 жыл бұрын
Wow, thanks for the tutorial! That seems to be a pretty precise way to control a gpu. Was feeling more nerdy than I prefer to while watching though. Haha.
@JeremyChone
@JeremyChone 3 жыл бұрын
Very nice. Love the by example approach.
@tojuju
@tojuju 3 жыл бұрын
i went over your videos months ago, but this time, i'm not going to give up to confusion. to those not in a graphics rendering or game dev background, this stuff seems so damned foreign..but stay strong, everyone!
@2etime
@2etime 3 жыл бұрын
Feel free to reach out if you need some help :)
@crearg8259
@crearg8259 2 жыл бұрын
Hi, I’m new to this area. I only had experience in cuda. Does M1 Pro/Max work the same way as Radeon does on MBP 2019-? I’m confused with the merged vRAM of silicon platform and does the 10 GPU cores of M-processors accelerate parallel computing like cuda does with its thousands of cuda cores?
@Txgdfgvz367ur
@Txgdfgvz367ur 2 жыл бұрын
Hi, thanks for these awesome videos, hopefully you're still active! I plan on using the shader to update an array using two other arrays similar to what you've described. I can't quite figure out how to get the full updated array back from the buffer after processing, to use on the CPU. trying to print the array after binding to memory just brings up the following. Hope that makes sense I'm fairly new to this!
@eldarsadykov
@eldarsadykov Жыл бұрын
Brilliant video!
@LaurentLaborde
@LaurentLaborde 3 жыл бұрын
Copy/paste from apple documentation : "Always use a multiple of a type’s stride instead of its size when allocating memory or accounting for the distance between instances in memory."
@2etime
@2etime 3 жыл бұрын
What did I say?
@LaurentLaborde
@LaurentLaborde 3 жыл бұрын
@@2etime when you allocate MTLBuffer your code use size instead of stride
@LaurentLaborde
@LaurentLaborde 3 жыл бұрын
with simple type, size and stride are probably the same anyway. But still :)
@2etime
@2etime 3 жыл бұрын
Ah! Yes I know this now. I hate the permanence of KZbin :(
@LaurentLaborde
@LaurentLaborde 3 жыл бұрын
@@2etime hehehe :D
@abil.sudarman
@abil.sudarman 3 жыл бұрын
well produced video!
@geekoutnerd7882
@geekoutnerd7882 2 жыл бұрын
Thank you so much.
@fsteaglech
@fsteaglech Жыл бұрын
Thank you! Very very nice video! I strongly believe that this is the only video / tutorial that explains loud and clear how to use GPU and metal to performs calulations instead of rendering! I have some issues - however - undestanding how to bind back complex data structures as results in Swift; in C with pointer is quite easy but in Swift is a bit tricky; can you point me to some examples? Thanks!
@2etime
@2etime Жыл бұрын
do you mean how to access the data into a Type on the swift side?
@AmitSingh-nr8jz
@AmitSingh-nr8jz 3 жыл бұрын
Simply Awesome !!!!!!!!!!!
@theupsiloninitiative8894
@theupsiloninitiative8894 Жыл бұрын
Hi, I love the videos. However, I specialize in cpp. Can you release a video of this but as a cpp (or I guess objective cpp) rather than a swift file?
@theupsiloninitiative8894
@theupsiloninitiative8894 Жыл бұрын
Could you also point me in the direction of resources that would help?
@brandonwinston
@brandonwinston 3 жыл бұрын
This is gold
@harshpatel105
@harshpatel105 3 жыл бұрын
Awesome :D
@essamal-mansouri2689
@essamal-mansouri2689 2 жыл бұрын
Did you try using the new m1 pro/max/ultra with Metal? I would really like to know how the unified memory architecture comes into play when it comes to sending data back and forth between cpu and gpu.
@2etime
@2etime 2 жыл бұрын
I’m getting one in a week and plan on checking that out asap :)
@2etime
@2etime 2 жыл бұрын
Ok… It works really well! My computer runs metal so much faster. However it could just be the upgrade! What specs do you want? :)
@essamal-mansouri2689
@essamal-mansouri2689 2 жыл бұрын
@@2etime Supposedly Apple uses a new unified architecture so that GPU and CPU both share memory. Does that affect how you would program for Metal? Especially when it comes to copying data / results. How does the performance compare to your previous machine? Do you feel the benchmarks are representative of how slow it is compared to NVIDIA?
@platin2148
@platin2148 4 жыл бұрын
So ideally we would also add a simd way just for good measure (by directly using the instrinsics).
@2etime
@2etime 4 жыл бұрын
I’m not sure how to do that. Can you elaborate a little bit for me?
@thecentury8803
@thecentury8803 4 жыл бұрын
@@2etime I think @platin21 is talking about the SIMD matrix computation from the Accelerate framework - developer.apple.com/documentation/accelerate/simd
@rty65tt40
@rty65tt40 11 ай бұрын
Hi. How do I set up metal to draw over the previous frame? For example, 1000 fixed triangles of different colors are drawn. And in each new frame, need to change the color of only 10 random triangle. I want to draw 10 triangle with the desired color and draw it on top of the previous frame.
@MrHirenP
@MrHirenP 3 жыл бұрын
Your metal shading language playlist has only video :(
@LeoJoseph-el8dt
@LeoJoseph-el8dt 6 ай бұрын
MTLValidateFeatureSupport:6508: failed assertion `Dispatch Threads with Non-Uniform Threadgroup Size is not supported on this device' When I am trying to run it on the simulator iPhone 15. What could be wrong?
@heltena
@heltena 3 жыл бұрын
Hey! Just a comment: the bindMemory(to:capacity:) expects capacity as the number of T elements, not bytes. (at 20:10, line 81)
@2etime
@2etime 3 жыл бұрын
Oh nice! Thank you!
@natgenesis5038
@natgenesis5038 11 ай бұрын
Can I use it to render image frames into video ? I never use metal before
@StuartDesign
@StuartDesign 4 жыл бұрын
Am I right in thinking that for processing a 2d texture, you would want the largest number of threads that will fit 'square' inside of each max thread group. Is this done to ensure that the uint2 thread coords align with texture's x,y coords? Or is it just as convenient/efficient to create thread groups that might be 'retangular'?
@chuhanfeng6552
@chuhanfeng6552 Жыл бұрын
How should I make a buffer for 2-D array? Do I have to concatenate it into 1D array?
@2etime
@2etime Жыл бұрын
i would make it a 1D array for sure. The information will be better if it is contiguous. If you want to access a value in the buffer / array you can use this formula where width is the column count of the 2d version.
@chuhanfeng6552
@chuhanfeng6552 Жыл бұрын
@@2etime Thank you.
@monfera
@monfera 2 жыл бұрын
The 3+ seconds for the CPU based componentwise addition of two arrays of 3 million numbers is some orders of magnitude too long, why is that? I get 0.02 seconds in JavaScript (not even a statically typed language, and time includes some interpreted execution and warmed up JIT compilation phases too): a = [...new Array(3e6)].map(Math.random); b = [...new Array(3e6)].map(Math.random); (t0 = performance.now(), result=new Array(3e6).fill(0), (() => {for(let i = 0; i < 3e6; i++) result[i]=a[i]+b[i]})(), console.log((performance.now() - t0)/1000), result);
@2etime
@2etime 2 жыл бұрын
interesting... My discord would love this question lol. I tested it out as well and seem to be getting pretty quick numbers in js too. computers are awesome! I think my main point in the video is running multiple functions at the same time, as opposed to linearly or single instruction multiple data (simd). www.heavy.ai/technical-glossary/cpu-vs-gpu
@ritikagupta5600
@ritikagupta5600 Жыл бұрын
I am new to MSL ios, I have a windows laptop, but I need to work on MSL , can anyone help me know which IDE should i be using now to start coding in metal?
@2etime
@2etime Жыл бұрын
You could prob use visual studio and use c++!
@ritikagupta5600
@ritikagupta5600 Жыл бұрын
@@2etime gr8 i found the plugin for msl for vsc. But , may be it is a dumb question but i don't know how do i run my project, any specific cli for vsc ?
@2etime
@2etime Жыл бұрын
I do not think you can run a project with a Windows machine. Hopefully somebody who knows more about that will post.
@ritikagupta5600
@ritikagupta5600 Жыл бұрын
@@2etime oh ok .. I thought so. Thank you so much for the reply
@2etime
@2etime Жыл бұрын
I would suggest learning OpenGL on windows! My videos will give you a high level understanding of graphics as a whole. OpenGL and metal are very similar regarding the pipeline of the gpu
@Enter_channel_name
@Enter_channel_name 4 жыл бұрын
GPU is executing multiple tasks all at once CPU is executing multiple tasks one at a time
@LaurentLaborde
@LaurentLaborde 3 жыл бұрын
I'm pretty sure you don't need to explain that we can do general purpose computation on GPU in 2020+ ;)
@LaurentLaborde
@LaurentLaborde 3 жыл бұрын
it's still a good tutorial of course. Thank you
@lijieyang2433
@lijieyang2433 9 ай бұрын
When I am trying to run main.swift, it turns out to show "main/main.swift:31: Fatal error: Unexpectedly found nil while unwrapping an Optional value", do you have any idea why this happens?
WebGPU :: Compute Shaders Crash Course For Beginners
20:00
Visionary 3D
Рет қаралды 8 М.
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 37 МЛН
When u fight over the armrest
00:41
Adam W
Рет қаралды 19 МЛН
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 71 МЛН
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 565 М.
How To Render CIRCLES (OpenGL/Vulkan/DirectX/Metal)
39:56
The Cherno
Рет қаралды 100 М.
SwiftUI + Metal - Create special effects by building your own shaders
1:16:26
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 724 М.
How A Steam Bug Deleted Someone’s Entire PC
11:49
Kevin Fang
Рет қаралды 1 МЛН
CUDA Programming on Python
21:34
Ahmad Bazzi
Рет қаралды 1,1 МЛН
I tried Swift and came out a different person
1:56:59
Tsoding Daily
Рет қаралды 112 М.
computers suck at division (a painful discovery)
5:09
Low Level
Рет қаралды 1,7 МЛН