Skip to content

Skip manifests already found when scanning search paths - #2033

Open
Wint3rNight wants to merge 1 commit into
KhronosGroup:mainfrom
Wint3rNight:fix-duplicate-icd-dedup
Open

Wint3rNight wants to merge 1 commit into
KhronosGroup:mainfrom
Wint3rNight:fix-duplicate-icd-dedup

Conversation

@Wint3rNight

Copy link
Copy Markdown
Contributor

Fixes #1874.

Duplicate elimination runs on the search path strings, so it does not catch the case where one path names a directory and another names a file inside that directory. The two strings differ, but the directory scan and the explicit file path resolve to the same manifest, so the driver is loaded twice and its physical devices are reported twice.

With VK_DRIVER_FILES set to a folder plus two manifests inside that folder, vkEnumeratePhysicalDevices reports 9 devices where 5 exist, matching the log in the issue:

Original order:
      [0] pd10   [1] pd11   [2] pd00   [3] pd01
      [4] pd10   [5] pd11   [6] pd00   [7] pd01
      [8] pd0

Both call sites in add_data_files resolve to a full path before calling add_if_manifest_file, so comparing the resolved name catches the repeat. The existing copy_str_to_string_list_if_unique helper already does exactly this.

This is only visible with Vulkan 1.1 or newer, because GPDP2 gates the Linux physical device sort. The existing env var tests run at 1.0, which is why CI never caught it.

Added EnvVarICDOverrideSetup.DirAndFileOverlapDoesNotDuplicate, which fails on main with 9 devices and passes with the fix. Full suite is 703/703.

Two notes:

  • add_data_files also serves layer discovery, so layers get the same protection. No existing test changes behaviour.
  • loader_get_fullpath does not canonicalise symlinks or .. segments, so two different spellings of the same file are still not detected. That is outside what this issue reports and I have left it alone.

The issue also suggests running these env var cases at both 1.0 and 1.1, since much loader logic depends on GPDP2. That is a broader testing change and I have kept it out of this PR, but happy to follow up if useful.

Duplicate elimination runs on the search path strings, so it cannot
catch the case where one path names a directory and another names a
file inside that directory. The two strings differ, but the directory
scan and the explicit file path resolve to the same manifest, so the
driver is loaded twice and its physical devices are reported twice.

Both call sites in add_data_files resolve to a full path before
reaching add_if_manifest_file, so comparing the resolved name is
enough to spot the repeat. The duplication is only visible with
Vulkan 1.1 or newer, because GPDP2 gates the Linux physical device
sort, which is why the existing tests at 1.0 did not catch it.
@ci-tester-lunarg

Copy link
Copy Markdown

Author Wint3rNight not on autobuild list. Waiting for curator authorization before starting CI build.

1 similar comment
@ci-tester-lunarg

Copy link
Copy Markdown

Author Wint3rNight not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build queued with queue ID 119687.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3766 running.

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.

Loader loads ICDs and reports physical devices twice on Linux when sorting is active

2 participants