Skip to content

Commit

Permalink
Surface target CPU info to GPU telemetry tests
Browse files Browse the repository at this point in the history
Bug: dawn:1401
Change-Id: Ibd2beebe8bda49f3ef2237ecda84c71828370085
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3891837
Reviewed-by: Maggie Chen <magchen@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1046636}
  • Loading branch information
austinEng authored and Chromium LUCI CQ committed Sep 13, 2022
1 parent 9e68217 commit 95b1d6d
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 13 deletions.
4 changes: 4 additions & 0 deletions content/test/gpu/gpu_tests/gpu_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ def GetAsanStatus(gpu_info: tgi.GPUInfo) -> str:
return 'no-asan'


def GetTargetCpuStatus(gpu_info):
return 'target-cpu-%s' % (gpu_info.aux_attributes.get('target_cpu_bits',
'unknown'), )

# TODO(rivr): Use GPU feature status for Dawn instead of command line.
def HasDawnSkiaRenderer(extra_browser_args: List[str]) -> bool:
if extra_browser_args:
Expand Down
1 change: 1 addition & 0 deletions content/test/gpu/gpu_tests/gpu_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ def GetPlatformTags(cls, browser: ct.Browser) -> List[str]:
gpu_tags.append(gpu_helper.GetCommandDecoder(gpu_info))
gpu_tags.append(gpu_helper.GetOOPCanvasStatus(gpu_info.feature_status))
gpu_tags.append(gpu_helper.GetAsanStatus(gpu_info))
gpu_tags.append(gpu_helper.GetTargetCpuStatus(gpu_info))
if gpu_info and gpu_info.devices:
for ii in range(0, len(gpu_info.devices)):
gpu_vendor = gpu_helper.GetGpuVendorString(gpu_info, ii)
Expand Down
54 changes: 41 additions & 13 deletions content/test/gpu/gpu_tests/gpu_integration_test_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def _GetSystemInfo( # pylint: disable=too-many-arguments
device_string: str = '',
passthrough: bool = False,
gl_renderer: str = '',
is_asan: bool = False) -> system_info.SystemInfo:
is_asan: bool = False,
target_cpu_bits: int = 64) -> system_info.SystemInfo:
sys_info = {
'model_name': '',
'gpu': {
Expand All @@ -71,6 +72,7 @@ def _GetSystemInfo( # pylint: disable=too-many-arguments
'aux_attributes': {
'passthrough_cmd_decoder': passthrough,
'is_asan': is_asan,
'target_cpu_bits': target_cpu_bits
},
'feature_status': {
'gpu_compositing': 'enabled',
Expand All @@ -94,10 +96,12 @@ def _GetTagsToTest(browser: fakes.FakeBrowser,
return tags


def _GenerateNvidiaExampleTagsForTestClassAndArgs(test_class: GpuTestClassType,
args: mock.MagicMock,
is_asan: bool = False
) -> Set[str]:
def _GenerateNvidiaExampleTagsForTestClassAndArgs(
test_class: GpuTestClassType,
args: mock.MagicMock,
is_asan: bool = False,
target_cpu_bits: int = 64,
) -> Set[str]:
tags = None
with mock.patch.object(
test_class, 'ExpectationsFiles', return_value=['exp.txt']):
Expand All @@ -108,7 +112,8 @@ def _GenerateNvidiaExampleTagsForTestClassAndArgs(test_class: GpuTestClassType,
gpu=VENDOR_NVIDIA,
device=0x1cb3,
gl_renderer='ANGLE Direct3D9',
is_asan=is_asan)
is_asan=is_asan,
target_cpu_bits=target_cpu_bits)
tags = _GetTagsToTest(browser, test_class)
return tags

Expand Down Expand Up @@ -187,9 +192,10 @@ def testTestNamePrefixGenerationInRunGpuIntegrationTests(self) -> None:
def _TestTagGenerationForMockPlatform(self,
test_class: GpuTestClassType,
args: mock.MagicMock,
is_asan: bool = False) -> Set[str]:
is_asan: bool = False,
target_cpu_bits: int = 64) -> Set[str]:
tag_set = _GenerateNvidiaExampleTagsForTestClassAndArgs(
test_class, args, is_asan)
test_class, args, is_asan, target_cpu_bits)
self.assertTrue(
set([
'win', 'win10', 'angle-d3d9', 'release', 'nvidia', 'nvidia-0x1cb3',
Expand All @@ -215,6 +221,27 @@ def testGenerateContextLostExampleTagsForNoAsan(self) -> None:
self.assertIn('no-asan', tag_set)
self.assertNotIn('asan', tag_set)

def testGenerateContextLostExampleTagsForTargetCpu(self) -> None:
args = gpu_helper.GetMockArgs()
self.assertIn(
'target-cpu-64',
self._TestTagGenerationForMockPlatform(
context_lost_integration_test.ContextLostIntegrationTest,
args,
target_cpu_bits=64))
self.assertIn(
'target-cpu-32',
self._TestTagGenerationForMockPlatform(
context_lost_integration_test.ContextLostIntegrationTest,
args,
target_cpu_bits=32))
self.assertIn(
'target-cpu-31',
self._TestTagGenerationForMockPlatform(
context_lost_integration_test.ContextLostIntegrationTest,
args,
target_cpu_bits=31))

def testGenerateWebglConformanceExampleTagsForWebglVersion1andAsan(self
) -> None:
args = gpu_helper.GetMockArgs(webgl_version='1.0.0')
Expand Down Expand Up @@ -251,7 +278,8 @@ def testGenerateNvidiaExampleTags(self) -> None:
_GetTagsToTest(browser),
set([
'win', 'win10', 'release', 'nvidia', 'nvidia-0x1cb3', 'angle-d3d9',
'no-passthrough', 'renderer-skia-gl', 'no-oop-c', 'no-asan'
'no-passthrough', 'renderer-skia-gl', 'no-oop-c', 'no-asan',
'target-cpu-64'
]))

@mock.patch('sys.platform', 'darwin')
Expand All @@ -267,8 +295,8 @@ def testGenerateVendorTagUsingVendorString(self) -> None:
_GetTagsToTest(browser),
set([
'mac', 'mojave', 'release', 'imagination', 'no-asan',
'imagination-PowerVR-SGX-554', 'angle-opengles', 'passthrough',
'renderer-skia-gl', 'no-oop-c'
'target-cpu-64', 'imagination-PowerVR-SGX-554', 'angle-opengles',
'passthrough', 'renderer-skia-gl', 'no-oop-c'
]))

@mock.patch('sys.platform', 'darwin')
Expand All @@ -282,8 +310,8 @@ def testGenerateVendorTagUsingDeviceString(self) -> None:
_GetTagsToTest(browser),
set([
'mac', 'mojave', 'release', 'imagination', 'no-asan',
'imagination-Triangle-Monster-3000', 'angle-disabled',
'no-passthrough', 'renderer-skia-gl', 'no-oop-c'
'target-cpu-64', 'imagination-Triangle-Monster-3000',
'angle-disabled', 'no-passthrough', 'renderer-skia-gl', 'no-oop-c'
]))

@mock.patch.dict(os.environ, clear=True)
Expand Down
2 changes: 2 additions & 0 deletions gpu/config/gpu_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
bool in_process_gpu;
bool passthrough_cmd_decoder;
bool is_asan;
uint32_t target_cpu_bits;
bool can_support_threaded_texture_mailbox;
#if BUILDFLAG(IS_MAC)
uint32_t macos_specific_texture_target;
Expand Down Expand Up @@ -387,6 +388,7 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
enumerator->AddBool("inProcessGpu", in_process_gpu);
enumerator->AddBool("passthroughCmdDecoder", passthrough_cmd_decoder);
enumerator->AddBool("isAsan", is_asan);
enumerator->AddInt("targetCpuBits", static_cast<int>(target_cpu_bits));
enumerator->AddBool("canSupportThreadedTextureMailbox",
can_support_threaded_texture_mailbox);
#if BUILDFLAG(IS_MAC)
Expand Down
8 changes: 8 additions & 0 deletions gpu/config/gpu_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,14 @@ struct GPU_EXPORT GPUInfo {
bool is_asan = false;
#endif

#if defined(ARCH_CPU_64_BITS)
uint32_t target_cpu_bits = 64;
#elif defined(ARCH_CPU_32_BITS)
uint32_t target_cpu_bits = 32;
#elif defined(ARCH_CPU_31_BITS)
uint32_t target_cpu_bits = 31;
#endif

#if BUILDFLAG(IS_MAC)
// Enum describing which texture target is used for native GpuMemoryBuffers on
// MacOS. Valid values are GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE_ARB.
Expand Down

0 comments on commit 95b1d6d

Please sign in to comment.