Discussion RDNA 5 / UDNA (CDNA Next) speculation

Page 19 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

basix

Member
Oct 4, 2024
132
272
96
I cannot tell you exactly, how intense matrix math is in game engines. But it is for certain, that matrices get used everywhere in games (you can google that if you want). And today this means, that you make N-times vector * vector math instead of 1-time matrix * vector. For some part this split into multiple vectors is useful, because it allows for easy parallelization on wide SIMD units of a GPU. But you can do that with matrices as well, because you have millions of pixels anyways.

I would suspect, that the cooperative vector API greatly reduce the transition overhead between matrix cores and other parts of a CU. And in the end, everything uses the same registers and caches of a CU or SM. So the main thing you need to care about is data alignment (vectors vs. matrices) that you do not need to shuffle around your data when switching between vectors and matrices. How big the actual benefits will be, have to be seen. I hope we see some talks and presentations about cooperative vectors from AMD, Nvidia and game developers.

For me, there is another reason for matrices:
Optimize performance in general. Game developers used vector math for ages. Now they could reshape their algorithms to do direct matrix math. Will it be faster? It depends on the use case. But I could very well imagine, that it would allow developers to push further. As you said, with matrix operations you optimize for bandwidth and power. Both is scarce on GPUs if you want to get optimal performance. Will that take some effort and time? Sure.

I do not see it happening too soon, earliest with the next console cycle because those will support WMMA acceleration. If you want to squeeze the maximum out of a console, optimize your code and increase the utilization of the available hardware units. Most image filters kernels (e.g. Lanczos) use matrices (e.g. postprocessing in games), vector*matrix for orientation & transformation of things, dot-products for geometric stuff and so on. If the data is aligned right, you can put that into vectors or matrices, the result is the same.
 
  • Haha
Reactions: Bigos

Bigos

Member
Jun 2, 2019
187
478
136
I cannot tell you exactly, how intense matrix math is in game engines. But it is for certain, that matrices get used everywhere in games (you can google that if you want). And today this means, that you make N-times vector * vector math instead of 1-time matrix * vector. For some part this split into multiple vectors is useful, because it allows for easy parallelization on wide SIMD units of a GPU. But you can do that with matrices as well, because you have millions of pixels anyways.

The matrices used in games are 4x4 at most and these are not the target of the tensor units. And the matrix x vector computations are not parallelized since terascale era.

What are you talking about?
 
  • Like
Reactions: marees

511

Platinum Member
Jul 12, 2024
2,579
2,418
106
I cannot tell you exactly, how intense matrix math is in game engines. But it is for certain, that matrices get used everywhere in games (you can google that if you want). And today this means, that you make N-times vector * vector math instead of 1-time matrix * vector. For some part this split into multiple vectors is useful, because it allows for easy parallelization on wide SIMD units of a GPU. But you can do that with matrices as well, because you have millions of pixels anyways.

I would suspect, that the cooperative vector API greatly reduce the transition overhead between matrix cores and other parts of a CU. And in the end, everything uses the same registers and caches of a CU or SM. So the main thing you need to care about is data alignment (vectors vs. matrices) that you do not need to shuffle around your data when switching between vectors and matrices. How big the actual benefits will be, have to be seen. I hope we see some talks and presentations about cooperative vectors from AMD, Nvidia and game developers.

For me, there is another reason for matrices:
Optimize performance in general. Game developers used vector math for ages. Now they could reshape their algorithms to do direct matrix math. Will it be faster? It depends on the use case. But I could very well imagine, that it would allow developers to push further. As you said, with matrix operations you optimize for bandwidth and power. Both is scarce on GPUs if you want to get optimal performance. Will that take some effort and time? Sure.

I do not see it happening too soon, earliest with the next console cycle because those will support WMMA acceleration. If you want to squeeze the maximum out of a console, optimize your code and increase the utilization of the available hardware units. Most image filters kernels (e.g. Lanczos) use matrices (e.g. postprocessing in games), vector*matrix for orientation & transformation of things, dot-products for geometric stuff and so on. If the data is aligned right, you can put that into vectors or matrices, the result is the same.
Second this evern a basic triangle which are used to render stuff even something as basic as where the point is inside the triangle or not require matrix operation like determinant of a matricd.
 

menhera

Junior Member
Dec 10, 2020
23
71
91
15442411512.png

I've noticed ray intersection (and traversal) performance in my 9070 XT is directly proportional to L0 cache hitrates.


AMD-RDNA-4-Compute-Engine.jpgAMD really should merge two separate L0 caches per WGP in UDNA.
 
  • Like
Reactions: igor_kavinski

Tuna-Fish

Golden Member
Mar 4, 2011
1,633
2,432
136
Second this evern a basic triangle which are used to render stuff even something as basic as where the point is inside the triangle or not require matrix operation like determinant of a matricd.

What Bigos said, yes everything is matrix math but also the matrices are all 4x4. The tensor units are optimized for much, much larger matrices.
 
  • Like
Reactions: marees