xe header organization leads to everything includes everything
The xe header organization mimics the worst parts of i915 gem/gt headers. Effectively, everything includes everything. For example, changing any of the drivers/gpu/drm/xe/abi/guc_*.h
headers leads to the rebuild of almost the entire driver. That's supposed to be a low level interface to GUC, not something that's required everywhere.
There seems to be a pattern that foo.h
includes foo_types.h
even when the former could and should just be an interface, operating on opaque types, with forward declarations.
See for example xe_pmu.h
. There are a total of 28 indirect dependencies that could have been two forward declarations. Changing any of those files causes the rebuild of 76 object files via the dependency on xe_pmu.h
, just because of the unnecessary includes.
Often the interface files foo.h
contain static inlines that do require pulling in foo_types.h
, which go on to pull in a bunch of other stuff. Those indirect dependencies appear to lead to definitions in the guc abi headers. You end up with a tangle where modifying almost any single file leads to the rebuild of almost the entire driver.
Static inlines are harmful. They should be justified by actual performance reasons. They are not pure interface, they leak the abstractions.
This adds up, quickly. It reduces the developer experience, it wastes the build resources. A git rebase -x make
to check that each commit builds takes longer than it really should.