Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Thread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535

Discussion in 'High Definition Render Pipeline' started by DeathRace26, Feb 14, 2020.

  1. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    I'm trying to port my game to HDRP. It is something like Motorm4x, and im trying to reach real HQ rendering. Hdrp's advantage is that metallic, occlusion and other important detail maps are baked in separate RGB channels which is big advantage for me as a developer. Sadly, i have error spam in console, saying stuff as stated in title. I tried several things and it turns i have to disable every gameobject to make these stupid errors dissapear. Could someone clarify what this error tries to tell me? It doesnt even make sense to me. If any unity dev is reading this, please help. Im struggling with this longer than a month.
     
  2. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi, could you give HDRP version, Unity version and your graphic card?
    Guess you are on 19.2 with 6.x version and an integrated intel GPU?

    This should be fix in 7.2.0 with 19.3
     
  3. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    I use HDRP 7.2.1, because was too afraid to use 7.1.8. I was getting constant mem leaks from procedural sky and with huge scene with tons of assets it really becomes a huge paint in the a*s.

    I use unity 2019.3f (i think first LTS canditate?)

    i have really old i3 CPU 3220. Not integrated, dual core. Nvidia GTX 960 4GB TI from ASUS. RAM mem is 12 gigs
     
  4. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Alirght, so given those new information this isn't something we have met up to now.

    With this message: "Thread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535" , it is suppose to related to a shader. Are you able to find which shader throw this message in the log (should be a compute shader) ?

    Or maybe there is a shader graph with a large number of stuff into it?
     
    DeathRace26 likes this.
  5. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    I have pretty big shader graph for vehicle skin. Something around 7-8 textures per car (normals included)
    Some shaders are also missing. If this problem is related to vertex count limit i can ensure you that is impossible in this case. I dont use any vertex displacement with geometry generation on car bodies.
     
  6. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    Important thing to report! After further investigation, i found out this is caused by render textures in my scene
     
  7. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    I still cannot fix the issue. When i enable Gameobject holding render texture, i get brutal memory leak. From 6 gigs of ram to 10 gigs according to task manager (using win 7)
     
  8. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi, sorry but I can't see how this is related to render texture. This is an error that is output during shader compilation (and it should be on pixel shader or compute shader). But hard to know more with information available.
     
  9. o2co2

    o2co2

    Joined:
    Aug 9, 2017
    Posts:
    45
    I did the same, hoping to get it resolved, and that's it after I reinstalled the system.



    Unity 2019.3.4 does not have a 65535 error, unity 2019.3.7 will have a 65535 error.
     
    Last edited: Mar 31, 2020
  10. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    This issue has just popped up for (again).

    I'm using 2019.3 w/ HDRP 7.2.0.

    Not sure what started it, but it's not happening in my old scenes, but when I create new scenes, it floods the console. All I have to do is create a new scene, press play and it will flood with this message in the console.
     
  11. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi, are you able to identify which shader cause this issue?
    Also can you provide your GPU spec. We are still not seeing this problem in our team and QA. We need more information to be able to repro it. Thanks
     
  12. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    Not sure how I'd tell what shader it's coming from as this is all I see in the console: upload_2020-4-6_8-32-48.png

    GPU is a 2080ti
     
  13. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    hmm so even harder to tell, most of us have a 2080 TI here and we don't have this issue.
    I will expect it is one of custom shader in your project? If you start from a fresh template do you get error? (then you can try to add various shader from your project until the console is spamming?
     
  14. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    Is there no other way to get information on what shader is causing this than to create a new project and one by one add shaders to it? That would take a lot of time.
     
  15. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    Update: created a new project, added all my VFX graphs and shaders from my main project into it. Cannot reproduce the thread count error.

    Update 2: pulled a fresh copy of the project from the repo in hopes that it might stop if I just reimport a new copy of the project. It still happens. Then I progressively deleted every folder under Assets/ and it still persists. At this point, I can just send you a zip of the project since it's less than 30kb. All that's left is my HDRP default settings, the HDRenderPipelineAsset and an empty scene file.

    Update 3: continued messing around, eventually discovered that it seems to be the OpenVR single pass and single pass instanced rendering. I've been using single pass instanced for several months without problems until now. If I switch it to multipass, the errors don't show up in play mode, but I really need the performance gains from single pass. And just to re-iterate, this only happens in new scenes. The old scenes continue to operate just fine. In fact, I just tried duplicating an old scene and deleting most of it and that also works. So uhh... idk man...
     
    Last edited: Apr 7, 2020
  16. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    Ok that was the end of a long day... new scenes do NOT work... I'd deleted cameras... adding a camera breaks it again.

    I tried switching to the new XR Plugin Management system, but now I'm finding that I don't even have the option of using single pass rendering with the WMR plugin? This is insane... every hoop i jump through there is a new problem.
     
  17. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    >At this point, I can just send you a zip of the project since it's less than 30kb. All that's left is my HDRP default settings, >the HDRenderPipelineAsset and an empty scene file.

    Hi, yes please you can send it to us.Or post it here.
     
  18. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    Hmmm... I tried it on another computer with a Vive headset and it didn't have the problem so I don't know how easy it will be to reproduce...

    Is there a way I could just suppress the message from the console?
     
  19. yaboiwesto

    yaboiwesto

    Joined:
    Feb 22, 2013
    Posts:
    1
    Hi Seb, so through some strange coincidence, I'm also experiencing this error, and I'm actually experiencing it using your Hydraulic Erosion example (small world I guess, eh?). This is my first foray into compute shaders, and I'm attempting to port my own erosion solver to the GPU in much the same way you did. While trying to reverse-engineer yours, I ran into this issue right off the bat, in the TerrainGeneration stage. Things work as expected with a Map Size setting <249, but anything above that generates a flat plane and an 'Thread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535.' error.
    Code (csharp):
    1. //Thread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535.
    2. UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
    3. HeightMapGenerator:GenerateHeightMapGPU(Int32) (at Assets/Hydraulic-Erosion/Assets/Scripts/HeightMapGenerator.cs:52)
    4. HeightMapGenerator:GenerateHeightMap(Int32) (at Assets/Hydraulic-Erosion/Assets/Scripts/HeightMapGenerator.cs:17)
    5. TerrainGenerator:GenerateHeightMap() (at Assets/Hydraulic-Erosion/Assets/Scripts/TerrainGenerator.cs:42)
    6. MeshEditor:OnInspectorGUI() (at Assets/Hydraulic-Erosion/Assets/Editor/MeshEditor.cs:13)
    7. UnityEngine.GUIUtility:ProcessEvent(Int32, In
    I'm running 2019.3.8f1, and I have a 2080 Super GPU. Any thoughts?
     
    Last edited: Apr 15, 2020
  20. ReniTheGhost

    ReniTheGhost

    Joined:
    Dec 8, 2014
    Posts:
    16
    I have the same issue, with 2019.3.3f1 and radeon rx 580series.
    Any solution ?
     
  21. S4UC1SS0N

    S4UC1SS0N

    Joined:
    May 29, 2014
    Posts:
    49
    Same issue here with a little demo scene using HDRP 7.2.1 @ 2019.3.6f1.
    I get this error only on the Mac platform (not on Windows), i'm using metal.
    I can share the build to you by PM @SebLagarde if you want but i can't find any button on this forum to do so from your profile.

    If it can help, here are some detailed log from by build and the used and mentionned shader graph :


    Mono path[0] = '/private/var/folders/yt/223vn28s3g343qrl6146x3tm0000gn/T/AppTranslocation/54F73375-1440-4559-9713-658A8E6488DB/d/BuildMac.app/Contents/Resources/Data/Managed'
    Mono config path = '/private/var/folders/yt/223vn28s3g343qrl6146x3tm0000gn/T/AppTranslocation/54F73375-1440-4559-9713-658A8E6488DB/d/BuildMac.app/Contents/MonoBleedingEdge/etc'
    Initialize engine version: 2019.3.6f1 (5c3fb0a11183)
    [Subsystems] Discovering subsystems at path /private/var/folders/yt/223vn28s3g343qrl6146x3tm0000gn/T/AppTranslocation/54F73375-1440-4559-9713-658A8E6488DB/d/BuildMac.app/Contents/Resources/Data/UnitySubsystems
    GfxDevice: creating device client; threaded=1
    2020-04-29 14:19:48.371 my-game[568:15882] iMac preferred device: AMD Radeon Pro Vega 64 (high power)
    2020-04-29 14:19:48.371 my-game[568:15882] Metal devices available: 1
    2020-04-29 14:19:48.371 my-game[568:15882] 0: AMD Radeon Pro Vega 64 (high power)
    2020-04-29 14:19:48.371 my-game[568:15882] Using device AMD Radeon Pro Vega 64 (high power)
    Initializing Metal device caps: AMD Radeon Pro Vega 64
    Begin MonoManager ReloadAssembly
    - Completed reload, in 0.105 seconds
    WARNING: Shader Unsupported: 'HDRP/Lit' - All passes removed
    WARNING: Shader Did you use #pragma only_renderers and omit this platform?
    WARNING: Shader Unsupported: 'Shader Graphs/Shader Master Props' - All passes removed
    WARNING: Shader Did you use #pragma only_renderers and omit this platform?
    UnloadTime: 0.559386 ms
    Thread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535.
    UnityEngine.Rendering.ScriptableRenderContext:Submit_Internal_Injected(ScriptableRenderContext&)
    UnityEngine.Rendering.ScriptableRenderContext:Submit_Internal()
    UnityEngine.Rendering.ScriptableRenderContext:Submit() (at /Users/builduser/buildslave/unity/build/Runtime/Export/RenderPipeline/ScriptableRenderContext.cs:84)
    UnityEngine.Rendering.HighDefinition.HDRenderPipeline:Render(ScriptableRenderContext, Camera[]) (at M:\gamedev\escape-game\Library\PackageCache\com.unity.render-pipelines.high-definition@7.2.1\Runtime\RenderPipeline\HDRenderPipeline.cs:1784)
    UnityEngine.Rendering.RenderPipeline:InternalRender(ScriptableRenderContext, Camera[]) (at /Users/builduser/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipeline.cs:34)
    UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal(RenderPipelineAsset, IntPtr) (at /Users/builduser/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipelineManager.cs:86)

    [./Runtime/Shaders/ComputeShader.cpp line 920]
    (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/RenderPipeline/ScriptableRenderContext.cs Line: 84)
     

    Attached Files:

    Last edited: Apr 29, 2020
  22. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    140
    I had the same problem. Using no SRP, just standard unity built in. I set threadGroupsX when dispatching to instanceCount / 64. In the Kernel, I used 64 as threadGroupSizeX. When I roughly hit the 3 million count of instances, the same error message appeared (65k limit etc...).

    I fixed it by setting the threadGroupsX and size to 512, according to my pc specs. The error was gone. I tested until 5 million instances. Don't know if this is helping someone.

    edit: Unity 2019.3.7f1, gforce 1050ti, windows 10
     
  23. Tech-Labs

    Tech-Labs

    Joined:
    Feb 5, 2014
    Posts:
    105
    I am having a similar issue with the Thread Group Count Error popping up. However, I did notice something.
    When I switch to my Scene view (in Play mode) and look from above at my scene, then the Error does occur when I pan out of my scene (Scene view is empty) and the Error disappears when I pan back to my scene (Scene view shows my GameObjects).
    So it seems it has something to do with the Editor and what is visible in the Scene View. Perhaps this helps in clearing this error?
     
  24. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    Any spr's right now just feel like not possible to use. Why in the hell is still no support for GPU instancing in shader graph? Alteast hide checkbox for instancing and dont try to pretend something works when it does not. Also, deprecating enlighten was a F***ing mistake. I could start another thread about this but how is it possible that GPU lightmapping randomly crashes due to memory errors, using CPU lightmapping is thousand times slower that enlighten. If you cant have one thing perfect, dont go into thousands of unfinished different things, leaving broken S*** behind, period.
    I will NOT use this engine under ANY circumstance for Desktop. Even on empty scene with one terrain, realtime reflection probe lags the S*** out of my GTX 960 4GB. C# is not for games and everyone should know that. And a good tip for everyone to make bigger game. Try to think twice, before trying to achieve top notch graphics in this thing. For me, final product quality wins compared to clean UI in editor, which customers will give 0 F***s about.
     
  25. ObiOneStenobi

    ObiOneStenobi

    Joined:
    Jan 20, 2017
    Posts:
    6
    Hi, I am having the same issue: Thread group count error spam in console. I have updated HDRP and ShaderGraph from 7.2.1 to 7.4.1 and Unity from 2019.3.0f6 to 2019.3.15f1 (before there were no related errors and was working all quite well)

    Yeah, something similar it's happening to me, but with different tabs/action and not only with scene view tab. For instance:
    - with a specific shadergraph shader file tab and scene/game view tab open;
    - when moving in scene view and looking at sprites (currently using the default shader: Sprites/Default)
    - when moving the cursor over this sprites in the hierarchy;
    - camera with rendertexture on and scene view open;
    - game and scene view active in the same time;
    However if I create a new scene in the same project and i create a camera with a render texture it doesn't create any errors, BUT if you reload the scene will create just 2 errors. And I can't replicate the other errors.

    So it might be a custom shader as suggested:
    I will now test with the shader that give me the errors and will report here.

    I have a GTX 1070 and I'm on windows 10.
     
    Last edited: Jun 26, 2020
  26. ObiOneStenobi

    ObiOneStenobi

    Joined:
    Jan 20, 2017
    Posts:
    6
    I have tried to place some object with the shader that was causing errors and open the shadergraph tab of that, but no error this time, everything seems normal. I have also tried with camera and rendertexture.
    However there is a strange rendering bug when switching from the scene that generate errors to the new scene: the light captured by the scene view camera remain the same in the new loaded scene.
     
  27. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    Hi!

    To clarify: this error message (Thread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535.) means that when you schedule a compute shader dispatch, at least one of the dimensions of the dispatch is too large, more than 65535 invocations.

    Read like this: a kernel has specified [numthreads(X0,Y0,Z0)]. When doing a dispatch call with (X,Y,Z) thread groups, you're telling the engine "hey, I want X*Y*Z separate invocations of a compute shader that has X0*Y0*Z0 threads". If either of X, Y or Z exceed 65536, this error is thrown.
     
    ObiOneStenobi and Zyblade like this.
  28. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    610
    Hi, I stumbled on this issue today and with me it is also because of a RenderTexture. If I use a 1024x1024 render texture: everything works perfectly fine. Bump it up to 2048x2048 and suddenly I get this error. Called in HDRenderPipeline.cs at line 1935.

    Sporting version 8.2.0
    Unity 2019.3.0f6
    GPU is an NVIDIA GeForce GTX 1060
    Probably doesn't matter, but using DX12

    (And yes I know 2K render texture is expensive, but I was trying stuff out and just wanted to ping that the Render Texture is, in fact, an issue.)
     
  29. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    Hi, For me this happened in my HDRP project when I used a tool to capture the high resolution screen shot from Main camera. For lower resolution of 1280 x 720 this was not a problem. But when I rendered the texture with high resolution of 6400 x 3600 then this error bumped and project started to freeze. But when I deleted the tool and the shaders of the tool, the error gone and the project is now again smooth.

    Unity 2019.4.5f1
    HDRP 7.3.1
    CPU intel i7-7th Gen
    Ram 16 GB
    GPU NVIDIA GeForce GTX 1050 ti
     
  30. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    75
    Yet to this day? No wonder so many mem leaks were happening to me. This explains a lot....
     
  31. Grasshat

    Grasshat

    Joined:
    Apr 4, 2020
    Posts:
    2
    So someone know how to deal with this ?
     
  32. Grasshat

    Grasshat

    Joined:
    Apr 4, 2020
    Posts:
    2
    I'm the same as you . Have you made it yet?
     
  33. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi, I don't think we have catch all the issue with the 65K limit but we have fixed a first one that's may solve the problem with high rez:

    https://github.com/Unity-Technologies/Graphics/pull/2068

    It also show an example about how to solve it.

    we will need to identify other compute shader if it happen in other context
     
    WaqasGameDev likes this.
  34. alfred_medivis

    alfred_medivis

    Joined:
    Jul 15, 2020
    Posts:
    2
    Looks like I am in similar company, as I also experienced this while referencing the Hydraulic Erosion Example while learning about Compute Shaders.

    I'm currently on Version 2019.3.12f1
    I assume this fix would require me to update to a more recent version of Unity?
     
  35. _slash_

    _slash_

    Joined:
    Mar 26, 2013
    Posts:
    37

    Sebastian Lague != Sébastien Lagarde
     
  36. _slash_

    _slash_

    Joined:
    Mar 26, 2013
    Posts:
    37
    For those having the issue regarding Lague's compute shader tutorial, just change numthreads in HeightMap.compute from [numthreads(1,1,1)] to [numthreads(64,1,1)]
    and the heightMap dispatch to heightMapComputeShader.Dispatch (0, Mathf.CeilToInt(map.Length/64f), 1, 1) in HeightMapGenerator

    Source (answer on GH)
     
    Hannes_Gook likes this.
  37. shiki_2022

    shiki_2022

    Joined:
    Aug 21, 2020
    Posts:
    11
    upload_2021-1-6_16-1-33.png
    I got the same issue. HDRP 7.3.1 unity2019.4.0 . when playing, ram up to 28GB.my pc total ram is 32G.
    RTX2080s

    And when double click the error, it jump to
    65535.png
     
    Last edited: Jan 6, 2021
    soleron likes this.
  38. BanzBowinkel

    BanzBowinkel

    Joined:
    Jun 17, 2015
    Posts:
    16
    Hey guys, had the same error.
    Popped on a VR project with Unity 2019.4.18 with HDRP 7.5.3.
    Turned out that I had cranked up the resolution of my HTC Vive to 300% in my SteamVR app.
    Lowering the resolution back to 150% fixed it.
    Hope that helps anyone ... cheers!
     
  39. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    568
    Same issue popping up in 2023.2.HDRP 16.0.4

    Also, on a different note,
    I do not use Raytracing in this project and I get an error like that.

    upload_2023-12-11_11-52-25.png
     
    Last edited: Dec 11, 2023