Skip to content

intel/compiler: Remove use of thread_local for opcode tables

Kenneth Graunke requested to merge kwg/mesa:tls into main

A number of people have reported issues with brw_eu.cpp's thread_local index -> opcode_desc mapping tables going awry. One example is that gtk4-demo seems to crash on iris. @zmike had also run into some issues with zink. Others on IRC had commented.

We had been using thread_local tables to avoid plumbing through a proper location to store them throughout all the code. There wasn't any real advantage, it was simply easier to do. This series instead creates a new structure, brw_isa_info, containing devinfo and the opcode mapping tables, and plumbs that all over the codebase instead of only passing devinfo. We could also extend it in the future to contain more information about the ISA encoding on a particular generation, if needed.

I had thought about plumbing brw_compiler through everywhere originally, but it felt wrong to include it in places like the aubinator tools, standalone assembler, and so on. brw_compiler contains a lot of options for...what kind of code we want to generate...optimization settings...which feels out of place in tools that really just want to interpret the ISA. So, I opted to make a new structure instead.

It would probably make sense to replace devinfo with this in more places, but I have only done what was needed for now.

With this, gtk4-demo no longer crashes for me.

Merge request reports