question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SharpGenException when running sample code

See original GitHub issue

Hi! This library looks neat, thanks for making it.

I’m trying to get it running on my GTX 960M laptop, which I’m hoping is not too old of a GPU?

Trying to run the example code from the README:

using ReadWriteBuffer<float> buffer = Gpu.Default.AllocateReadWriteBuffer<float>(1000);
Gpu.Default.For(1000, id => buffer[id.X] = id.X);
float[] array = buffer.GetData();

using .NET Core 3 preview 9 in VS 2019 with the latest package from NuGet, I get the following unhandled exception on the 2nd line:

SharpGen.Runtime.SharpGenException: 'HRESULT: [0x80004005], Module: [General], ApiCode: [E_FAIL/Unspecified error], Message: Unspecified error
'

I tried cloning the repo and running ComputeSharp.Sample and ComputeSharp.ImageProcessing and they both fail with the same exception on NativePipelineState = device.NativeDevice.CreateComputePipelineState(this); in the PipelineState constructor, with the following call stack:

[External Code]
ComputeSharp.Graphics.dll!ComputeSharp.Graphics.Commands.PipelineState.PipelineState(ComputeSharp.Graphics.GraphicsDevice device, Vortice.Direct3D12.ID3D12RootSignature rootSignature, Vortice.Direct3D12.ShaderBytecode computeShader) Line 21	C#	ComputeSharp.Shaders.dll!ComputeSharp.Shaders.ShaderRunner.Run(ComputeSharp.Graphics.GraphicsDevice device, int x, int y, int z, int threadsX, int threadsY, int threadsZ, System.Action<ComputeSharp.ThreadIds> action) Line 95	C#
ComputeSharp.Shaders.dll!ComputeSharp.Shaders.ShaderRunner.Run(ComputeSharp.Graphics.GraphicsDevice device, int x, int y, int z, System.Action<ComputeSharp.ThreadIds> action) Line 37	C#
ComputeSharp.dll!ComputeSharp.GraphicsDeviceExtensions.For(ComputeSharp.Graphics.GraphicsDevice device, int x, System.Action<ComputeSharp.ThreadIds> action) Line 18	C#
ComputeSharp.Sample.dll!ComputeSharp.Sample.Program.Main() Line 30	C#

Any idea what might be happening and how to fix it?

Cheers.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Sergio0694commented, Sep 7, 2019

Thank you for your update! I think it’s safe to say that it’s the GTX960M that doesn’t properly support the necessary features then, that’s unfortunate 😟

Still though, I’m not really sure why you’re getting that ugly error instead of the expected NotSupportedException error that ComputeSharp is supposed to throw in this case.

I’ll try to see if I can figure out why this is happening!

0reactions
eliseecommented, Sep 14, 2019

@Sergio0694 tried it just now, it looks like it ran properly? didn’t get any exception:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

xaudio2.h(65,68): Process error CX0001: cannot call ...
i try to compile the old SharpDX library using windows 10 64 but, visual studio 2019 but when I'm loading SharpDX.sln and hit...
Read more >
ArgumentException when trying to draw in c# Form
ArgumentException was unhandled HResult=-2147024809 Message=Invalid Parameter. Source=System.Drawing StackTrace: at System.Drawing.Graphics.
Read more >
SharpGenTools Documentation
SharpGenTools is a code generator that generates C# for ... your SharpGen Mapping tutorial. ... Rules) to still run on these elements.
Read more >
ComputeSharp
I am trying to run the "Advanced Usage" example in Readme.md but it throws an System.InvalidOperationException . Any call to a static method...
Read more >
Operational Challenges in Offensive C# | by Ryan Cobb
Another feature of SharpGen to be aware of, is that SharpGen attempts to optimize your source code by removing unused types. It does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found