include:
  - local: 'src/amd/ci/gitlab-ci-inc.yml'

# Run five jobs in parallel each running 1/55th of the test suite
radv-stoney-vkcts:x86_64:
  extends:
    - .lava-test-deqp:x86_64
    - .radv-stoney-test:x86_64
  parallel: 5
  variables:
    DEQP_FRACTION: 11

radv-stoney-angle:
  extends:
    - .lava-test-deqp:x86_64
    - .radv-stoney-test:x86_64
  variables:
    DEQP_SUITE: radv-stoney-angle
    USE_ANGLE: 1
    HWCI_START_XORG: 1
    GPU_VERSION: angle-radv-stoney-aco

radv-stoney-angle-full:
  extends:
    - radv-stoney-angle
    - .radv-valve-manual-rules
  parallel: 2
  variables:
    DEQP_SUITE: radv-stoney-angle-full
    JOB_TIMEOUT: 60

radeonsi-stoney-gl:x86_64:
  extends:
    - .lava-test-deqp:x86_64
    - .radeonsi-stoney-test:x86_64
  parallel: 11
  variables:
    DEQP_SUITE: radeonsi-stoney
    HWCI_START_WESTON: 1

radeonsi-stoney-traces:x86_64:
  extends:
    - .lava-piglit-traces:x86_64
    - .radeonsi-stoney-test:x86_64
  variables:
    EGL_PLATFORM: surfaceless
    PIGLIT_TRACES_FILE: traces-amd.yml
    PIGLIT_REPLAY_EXTRA_ARGS: --keep-image

radv-raven-vkcts:x86_64:
  extends:
    - .lava-test-deqp:x86_64
    - .radv-raven-test:x86_64
    - .lava-asus-CM1400CXA-dalboz:x86_64
  parallel: 9
  variables:
    DEQP_VER: vk
    DEQP_FRACTION: 6

amd-raven-skqp:x86_64:
  extends:
    - .lava-test-deqp:x86_64
    - .amd-raven-test:x86_64
    - .lava-lenovo-TPad-C13-Yoga-zork:x86_64
  variables:
    HWCI_START_WESTON: 1
    DEQP_SUITE: amd-raven-skqp

radv-raven-traces:x86_64:
  extends:
    - .lava-piglit-traces:x86_64
    - .radv-raven-test:x86_64
    - .lava-lenovo-TPad-C13-Yoga-zork:x86_64
  variables:
    HWCI_START_XORG: 1
    PIGLIT_PLATFORM: mixed_glx_egl  # TODO, take wine/VK in account
    PIGLIT_REPLAY_DEVICE_NAME: "vk-${GPU_VERSION}"
    PIGLIT_TRACES_FILE: traces-amd.yml

radv-raven-traces-restricted:x86_64:
  extends:
    - .lava-piglit-traces:x86_64
    - .radv-raven-test:x86_64
    - .lava-lenovo-TPad-C13-Yoga-zork:x86_64
    - .radv-collabora-rules-restricted
  variables:
    HWCI_START_WESTON: 1
    PIGLIT_REPLAY_ANGLE_TAG: "2023-02-10-1"
    PIGLIT_TRACES_FILE: restricted-traces-amd.yml
    PIGLIT_REPLAY_DEVICE_NAME: "vk-${GPU_VERSION}"
    PIGLIT_REPLAY_EXTRA_ARGS: --keep-image --minio_bucket=${S3_TRACIE_PRIVATE_BUCKET} --jwt-file=${S3_JWT_FILE}
    FDO_CI_CONCURRENT: 10

radeonsi-raven-piglit-quick_gl:x86_64:
  extends:
    - .lava-piglit:x86_64
    - .radeonsi-raven-test:x86_64
    - .lava-lenovo-TPad-C13-Yoga-zork:x86_64
  variables:
    PIGLIT_PLATFORM: mixed_glx_egl
    PIGLIT_PROFILES: quick_gl
    HWCI_START_WESTON: 1

radeonsi-raven-piglit-quick_shader:x86_64:
  extends:
    - radeonsi-raven-piglit-quick_gl:x86_64
  variables:
    PIGLIT_PROFILES: quick_shader
    PIGLIT_FRACTION: 2

radeonsi-raven-va:x86_64:
  extends:
    - .lava-test-deqp:x86_64
    - .radeonsi-raven-test:x86_64
    - .radeonsi-vaapi-rules
    - .lava-asus-CM1400CXA-dalboz:x86_64
  variables:
    HWCI_TEST_SCRIPT: "/install/gtest-runner.sh"
    # While the tests don't need Xorg, it's an easy way to keep DRM open so we don't
    # spend all our time in drm_lastclose()'s modesetting.
    HWCI_START_WESTON: 1
    GTEST: test_va_api
    # The big 10-surface 10k allocations oomkill us at around 2.5G of GPU memory
    # allocated if we run at the normal 4 threads.
    # https://github.com/intel/libva-utils/issues/248
    FDO_CI_CONCURRENT: 1
    # A whole run would be about 25 minutes currently.  Fixing
    # https://github.com/intel/libva-utils/issues/247 and
    # https://github.com/google/googletest/issues/3614 would probably help.
    GTEST_FRACTION: 2

radeonsi-raven-va-full:x86_64:
  extends:
    - radeonsi-raven-va:x86_64
    - .radeonsi-vaapi-manual-rules
  variables:
    JOB_TIMEOUT: 60
    GTEST_FRACTION: null

############### VKCTS tests ###############

# VKCTS never finishes on gfx7 due to all the GPU resets and hangs.
# Hence, disable it for now.
.vkcts-kabini-valve:
  extends:
    - .vkcts-test-valve
    - .kabini-test-valve
    - .radv-valve-manual-rules  # Make sure this job is *always* run manually
  timeout: 12h
  variables:
    GPU_VERSION: radv-kabini-aco
    B2C_TIMEOUT_BOOT_MINUTES: 710
    B2C_TIMEOUT_OVERALL_MINUTES: 710
    B2C_TIMEOUT_BOOT_RETRIES: 0

# Disabled for now due to Igalia farm issues.
.vkcts-stoney-valve:
  extends:
    - .vkcts-test-valve
    - .radv-valve-manual-rules
  parallel: 2
  # The thin clients can't manage a full run in less than an hour
  # currently.  Interpolation suggests four more thin clients (6
  # total) would get the runtime under 15 minutes.
  timeout: 4h 10m
  variables:
    GPU_VERSION: radv-stoney-aco
    # Note, it only has a wee 32g disk!
    B2C_KERNEL_CMDLINE_EXTRAS: 'b2c.swap=8g'
    B2C_TIMEOUT_BOOT_MINUTES: 240
    B2C_TIMEOUT_OVERALL_MINUTES: 240
    B2C_TIMEOUT_BOOT_RETRIES: 0
  tags:
    - farm:$RUNNER_FARM_LOCATION
    - amdgpu:codename:STONEY

vkcts-tahiti-valve:
  extends:
    - .vkcts-test-valve
    - .tahiti-test-valve
    - .radv-valve-manual-rules  # Make sure this job is *always* run manually
  timeout: 6h
  variables:
    GPU_VERSION: radv-tahiti-aco
    B2C_TIMEOUT_BOOT_MINUTES: 350
    B2C_TIMEOUT_OVERALL_MINUTES: 350
    B2C_TIMEOUT_BOOT_RETRIES: 0

vkcts-polaris10-valve:
  extends:
    - .vkcts-test-valve
    - .polaris10-test-valve-kws
    - .radv-valve-manual-rules
  timeout: 1h 15m
  variables:
    GPU_VERSION: radv-polaris10-aco
    B2C_TIMEOUT_BOOT_MINUTES: 70
    B2C_TIMEOUT_OVERALL_MINUTES: 70

vkcts-vega10-valve:
  extends:
    - .vkcts-test-valve
    - .vega10-test-valve
    - .radv-valve-manual-rules
  timeout: 1h 15m
  variables:
    GPU_VERSION: radv-vega10-aco
    B2C_TIMEOUT_BOOT_MINUTES: 70
    B2C_TIMEOUT_OVERALL_MINUTES: 70
    RADV_PERFTEST: transfer_queue

vkcts-renoir-valve:
  extends:
    - .vkcts-test-valve
    - .renoir-test-valve
    - .radv-valve-manual-rules
  timeout: 2h 15m
  variables:
    GPU_VERSION: radv-renoir-aco
    B2C_TIMEOUT_BOOT_MINUTES: 130
    B2C_TIMEOUT_OVERALL_MINUTES: 130
    RADV_PERFTEST: transfer_queue

vkcts-navi10-valve:
  parallel: 2
  extends:
    - .vkcts-test-valve
    - .navi10-test-valve-kws
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-navi10-aco
    RADV_PERFTEST: transfer_queue

vkcts-navi21-valve:
  timeout: 35m
  parallel: 3
  extends:
    - .vkcts-test-valve
    - .navi21-test-valve
    - .radv-valve-rules
  variables:
    GPU_VERSION: radv-navi21-aco
    B2C_TIMEOUT_BOOT_MINUTES: 30
    B2C_TIMEOUT_OVERALL_MINUTES: 30
    RADV_PERFTEST: transfer_queue

# Disabled due to its extremelly-broken nature
.vkcts-navi21-llvm-valve:
  extends:
    - .vkcts-test-valve
    - .navi21-test-valve
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-navi21-llvm
    RADV_DEBUG: llvm,checkir

vkcts-vangogh-valve:
  parallel: 2
  extends:
    - .vkcts-test-valve
    - .vangogh-test-valve
    - .radv-valve-manual-rules
  timeout: 2h 10m
  variables:
    GPU_VERSION: radv-vangogh-aco
    RADV_PERFTEST: transfer_queue

glcts-vangogh-valve:
  extends:
    - .b2c-x86_64-test-gl
    - .b2c-deqp-test
    - .vangogh-test-valve
    - .radeonsi-valve-manual-rules
  timeout: 60m
  variables:
    GPU_VERSION: radeonsi-vangogh
    DEQP_SUITE: radeonsi-vangogh

vkcts-navi31-valve:
  parallel: 2
  extends:
    - .vkcts-test-valve
    - .navi31-test-valve
    - .radv-valve-rules
  variables:
    GPU_VERSION: radv-navi31-aco
    RADV_DEBUG: nomeshshader # Disable mesh shaders until task shaders stop hanging
    RADV_PERFTEST: transfer_queue

############### Fossilize
radv-fossils:
  extends:
    - .radv-valve-rules
    - .test-vk
    - .test-radv
    - .fossilize-test
  script:
    - export LD_PRELOAD=$PWD/install/lib/libamdgpu_noop_drm_shim.so
    # Pitcairn (GFX6)
    - AMDGPU_GPU_ID="PITCAIRN"
      ./install/fossilize-runner.sh
    # Bonaire (GFX7)
    - AMDGPU_GPU_ID="BONAIRE"
      ./install/fossilize-runner.sh
    # Polaris10 (GFX8)
    - AMDGPU_GPU_ID="POLARIS10"
      ./install/fossilize-runner.sh
    # Vega10 (GFX9)
    - AMDGPU_GPU_ID="VEGA10"
      ./install/fossilize-runner.sh
    # Navi10 (GFX10)
    - AMDGPU_GPU_ID="NAVI10"
      ./install/fossilize-runner.sh
    # Navi21 (GFX10_3)
    - AMDGPU_GPU_ID="NAVI21"
      ./install/fossilize-runner.sh
    # RDNA3 (GFX11)
    - AMDGPU_GPU_ID="NAVI31"
      ./install/fossilize-runner.sh
    # RDNA3.5 (GFX1150)
    - AMDGPU_GPU_ID="GFX1150"
      ./install/fossilize-runner.sh

############### vkd3d-proton

vkd3d-tahiti-valve:
  extends:
    - .b2c-test-radv-vk
    - .b2c-vkd3d-proton-test
    - .tahiti-test-valve
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-tahiti
    # Random tests fail/crash when trying to run them in parallel
    FDO_CI_CONCURRENT: 1

vkd3d-polaris10-valve:
  extends:
    - .b2c-test-radv-vk
    - .b2c-vkd3d-proton-test
    - .polaris10-test-valve-kws
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-polaris10
    # Random tests fail/crash when trying to run them in parallel
    FDO_CI_CONCURRENT: 1

vkd3d-vega10-valve:
  extends:
    - .b2c-test-radv-vk
    - .b2c-vkd3d-proton-test
    - .vega10-test-valve
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-vega10
    # Random tests fail/crash when trying to run them in parallel
    FDO_CI_CONCURRENT: 1

vkd3d-renoir-valve:
  extends:
    - .b2c-test-radv-vk
    - .b2c-vkd3d-proton-test
    - .renoir-test-valve
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-renoir
    # Random tests fail/crash when trying to run them in parallel
    FDO_CI_CONCURRENT: 1

vkd3d-navi10-valve:
  extends:
    - .b2c-test-radv-vk
    - .b2c-vkd3d-proton-test
    - .navi10-test-valve-mupuf
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-navi10
    # Random tests fail/crash when trying to run them in parallel
    FDO_CI_CONCURRENT: 1

vkd3d-navi21-valve:
  extends:
    - .b2c-test-radv-vk
    - .b2c-vkd3d-proton-test
    - .navi21-test-valve
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-navi21
    # Random tests fail/crash when trying to run them in parallel
    FDO_CI_CONCURRENT: 1

vkd3d-vangogh-valve:
  extends:
    - .b2c-test-radv-vk
    - .b2c-vkd3d-proton-test
    - .vangogh-test-valve
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-vangogh
    # Random tests fail/crash when trying to run them in parallel
    FDO_CI_CONCURRENT: 1

vkd3d-navi31-valve:
  extends:
    - .b2c-test-radv-vk
    - .b2c-vkd3d-proton-test
    - .navi31-test-valve
    - .radv-valve-manual-rules
  variables:
    GPU_VERSION: radv-navi31
    # Random tests fail/crash when trying to run them in parallel
    FDO_CI_CONCURRENT: 1
