Skip to content

Replace Pm4InfoInit with call once init.#687

Open
hysw wants to merge 2 commits intogoogle:mainfrom
hysw:pm4init
Open

Replace Pm4InfoInit with call once init.#687
hysw wants to merge 2 commits intogoogle:mainfrom
hysw:pm4init

Conversation

@hysw
Copy link
Collaborator

@hysw hysw commented Jan 5, 2026

Note: "pm4_info.h" is a generated file, and have convoluted include path requirements.

wangra-google
wangra-google previously approved these changes Jan 5, 2026
@shanminchao
Copy link
Collaborator

This PR replaces "Pm4InfoInit()" with a "Dive::InitDiveCore()". Why is this better?
Not explicitly against this change, but wondering what we're trying to solve here?

@hysw
Copy link
Collaborator Author

hysw commented Jan 9, 2026

but wondering what we're trying to solve here

Dependency management, so we don't need things like

# For generated headers
include_directories(${CMAKE_CURRENT_BINARY_DIR}/dive_core)

that shows up on ever single target regardless if they depend on dive_core. There's a few more header I need to look at so it is not removed just yet.

@shanminchao
Copy link
Collaborator

but wondering what we're trying to solve here

Dependency management, so we don't need things like

# For generated headers
include_directories(${CMAKE_CURRENT_BINARY_DIR}/dive_core)

that shows up on ever single target regardless if they depend on dive_core. There's a few more header I need to look at so it is not removed just yet.

Still not understanding what replacing Pm4InfoInit with a custom init has to do with dive_core include path.
Doesn't replacing "pm4_info.h" with "dive_core/pm4_info.h" do the same thing?

@hysw
Copy link
Collaborator Author

hysw commented Jan 12, 2026

Still not understanding what replacing Pm4InfoInit with a custom init has to do with dive_core include path.
Doesn't replacing "pm4_info.h" with "dive_core/pm4_info.h" do the same thing?

pm4_info.h is a generated file that resides in ${DIVE}/build/dive_core/pm4_info.h which requires -I${DIVE}/build/dive_core to be included in every dependent target, having a "dive_core/dive_core_init.h" means the the normal -I${DIVE} is sufficient.


Note: This is the include path for dive ui, and about half of them does not need to be there

-I/repo/dive/build/ui
-I/repo/dive/ui
-I/repo/dive/build/ui/dive_ui_autogen/include_Debug
-I/repo/dive/build/dive_core
-I/repo/dive/third_party/libarchive/libarchive
-I/repo/dive/LibArchive_INCLUDE_DIRS
-I/repo/dive/third_party/Vulkan-Headers/include
-I/repo/dive
-I/repo/dive/build
-I/repo/dive/third_party/abseil-cpp
-I/repo/dive/src
-I/repo/dive/dive_core/../third_party/gfxreconstruct/framework
-I/repo/dive/build/dive_core/freedreno/isa
-I/repo/dive/third_party/mesa/src/freedreno/common
-I/repo/dive/third_party/mesa/src
-I/repo/dive/third_party/mesa/include
-I/repo/dive/src/dive
-I/repo/dive/build/generated/Debug/include

@shanminchao
Copy link
Collaborator

Still not understanding what replacing Pm4InfoInit with a custom init has to do with dive_core include path.
Doesn't replacing "pm4_info.h" with "dive_core/pm4_info.h" do the same thing?

pm4_info.h is a generated file that resides in ${DIVE}/build/dive_core/pm4_info.h which requires -I${DIVE}/build/dive_core to be included in every dependent target, having a "dive_core/dive_core_init.h" means the the normal -I${DIVE} is sufficient.

Note: This is the include path for dive ui, and about half of them does not need to be there

-I/repo/dive/build/ui
-I/repo/dive/ui
-I/repo/dive/build/ui/dive_ui_autogen/include_Debug
-I/repo/dive/build/dive_core
-I/repo/dive/third_party/libarchive/libarchive
-I/repo/dive/LibArchive_INCLUDE_DIRS
-I/repo/dive/third_party/Vulkan-Headers/include
-I/repo/dive
-I/repo/dive/build
-I/repo/dive/third_party/abseil-cpp
-I/repo/dive/src
-I/repo/dive/dive_core/../third_party/gfxreconstruct/framework
-I/repo/dive/build/dive_core/freedreno/isa
-I/repo/dive/third_party/mesa/src/freedreno/common
-I/repo/dive/third_party/mesa/src
-I/repo/dive/third_party/mesa/include
-I/repo/dive/src/dive
-I/repo/dive/build/generated/Debug/include

Ah ok. that's starting to make sense.
And just to be clear, we still need I${DIVE}/build/dive_core for dive_core project itself still, since dive_core_init.cpp includes pm4_init.h. But the benefit is that this I${DIVE}/build/dive_core is only needed for dive_core and not everywhere else. Is that correct?

@hysw
Copy link
Collaborator Author

hysw commented Jan 12, 2026

And just to be clear, we still need I${DIVE}/build/dive_core for dive_core project itself still, since dive_core_init.cpp includes pm4_init.h. But the benefit is that this I${DIVE}/build/dive_core is only needed for dive_core and not everywhere else. Is that correct?

Yes. dive_core itself still include everything it needs, just that it does not need to pollute the include directory of other targets. Although there's still some reference to "adreno.h" that need to be cleaned up, which I'll do in a different PR.

A secondary benefit of not having include to a generated file is that all the static analysis tool works better (e.g. github can find symbol definition of InitDiveCore but not Pm4InfoInit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants