m4rs-mt / ILGPU

ILGPU JIT Compiler for high-performance .Net GPU programs
http://www.ilgpu.net
Other
1.38k stars 117 forks source link

(WIP) Add basic support for Roslyn Analyzers #1120

Closed Yey007 closed 10 months ago

Yey007 commented 11 months ago

Hello! This is a proof-of-concept for shipping Roslyn Analyzers with ILGPU. The intent is to build a framework to easily add analyzers in the future, and provide a basic one that covers one of the common beginner mistakes with ILGPU: using reference types in the kernel.

TODO:

Yey007 commented 11 months ago

A couple of questions for discussion that came up while implementing the reference type analyzer specifically:

  1. Should errors trace back to the point reference types are instantiated? Or should they pop up anywhere they're used?
  2. Similarly, should invoked methods that use reference types be highlighted at the invocation as well as at the usage of the reference type? Currently this is not the behavior.
  3. How much effort do we want to put into discovering methods that are kernels? Dataflow analysis can probably be used to achieve somewhat good coverage, depending on the current implementation of the API in Roslyn. I haven't looked much into how it works.
  4. Does having KernelAnalyzer as a base class seem useful? I don't know how many of our analyzers will really require the behavior of going through every line of code potentially accessible from a kernel.
Yey007 commented 10 months ago

Closing in favor of rewriting changes on top of #982.