[Openmp-commits] [openmp] [Libomptarget] Minimize use of 'REPORT' in the plugin interface (PR #78182)

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 16 09:31:06 PST 2024


jhuber6 wrote:

> Generally, fewer switches please, especially CMAKE.
> 
> I believe this is conceptually the right way to go. That said, our errors are not great, they should contain source information from where they were fired. That would make the pinpointing similarly easy. I can see it might be a little more involved in 1-2 places, but a single consistent error model is better than 2, or more.

I've been thinking about this. First off I think we should ditch `LIBOMPTARGET_DEBUG` entirely and just key off of `NDEBUG` like assertions do. Then we can improve the `DP` macro to make it easier to use.

Right now we make every error use `inconvertibleErrorCode()` which could be replaced with an actual value at a minimum. We could also make the interface automatically insert source location information if present. I think the easiest way to do this is to have TLS that contains the source location at a top level, then the rest of the runtime can simply read from it if it's been set. One difficulty would be how to present these errors to the user as part of an API, perhaps we return an index into some table that contains the last error message printed from the error type?

I think we should focus on this once we find a good way to remove the `dlopen` barrier between the plugins, primarily because it would allow us to have a single state space within the library.

That being said, I think this patch is a reasonable step forward. Future work would be an error handling overhaul.

https://github.com/llvm/llvm-project/pull/78182


More information about the Openmp-commits mailing list