#
#  Copyright (c) 2019-2023, Intel Corporation
#
#  SPDX-License-Identifier: BSD-3-Clause

# Functional tests enabled in CI

# auto | --cpu | --gpu
test_add(NAME simple host_simple "")
test_add(NAME simple host_simple --cpu)
test_add(NAME simple host_simple --gpu)

# auto | --cpu | --gpu
test_add(NAME simple-usm host_simple-usm "")
test_add(NAME simple-usm host_simple-usm --cpu)
test_add(NAME simple-usm host_simple-usm --gpu)

# auto | --cpu | --gpu
test_add(NAME simple-fence host_simple-fence "")
test_add(NAME simple-fence host_simple-fence --cpu)
test_add(NAME simple-fence host_simple-fence --gpu)

test_add(NAME usm-mem host_usm-mem 1)
test_add(NAME usm-mem host_usm-mem 2)

# iterations, width, height
test_add(NAME aobench TEST_IS_ISPCRT_RUNTIME RES_IMAGE "ao-ispc-gpu.ppm" REF_IMAGE "ao-ispc-cpu.ppm" IMAGE_CMP_TH "0.005" host_aobench 3 32 32)
test_add(NAME aobench TEST_IS_ISPCRT_RUNTIME RES_IMAGE "ao-ispc-gpu.ppm" REF_IMAGE "ao-ispc-cpu.ppm" IMAGE_CMP_TH "0.002" host_aobench 3 64 64)
test_add(NAME aobench TEST_IS_ISPCRT_RUNTIME RES_IMAGE "ao-ispc-gpu.ppm" REF_IMAGE "ao-ispc-cpu.ppm" IMAGE_CMP_TH "0.004" host_aobench 3 128 128)
test_add(NAME aobench TEST_IS_ISPCRT_RUNTIME RES_IMAGE "ao-ispc-gpu.ppm" REF_IMAGE "ao-ispc-cpu.ppm" IMAGE_CMP_TH "0.003" host_aobench 3 256 256)
#
test_add(NAME mandelbrot TEST_IS_ISPCRT_RUNTIME RES_IMAGE "mandelbrot-ispc-gpu.ppm" REF_IMAGE "mandelbrot-ispc-cpu.ppm" IMAGE_CMP_TH "0.025" host_mandelbrot)
test_add(NAME mandelbrot TEST_IS_ISPCRT_RUNTIME host_mandelbrot --scale=2)
# iterations, gx, gy
test_add(NAME noise host_noise 3 1 16)
# size, iterations, gx, gy
test_add(NAME sgemm host_sgemm 32 1 1 1)
test_add(NAME sgemm host_sgemm 32 1 1 2)
test_add(NAME sgemm host_sgemm 32 1 1 4)
test_add(NAME sgemm host_sgemm 32 1 1 8)
test_add(NAME sgemm host_sgemm 32 1 1 16)
test_add(NAME sgemm host_sgemm 32 1 1 32)
test_add(NAME sgemm host_sgemm 64 1 1 1)
test_add(NAME sgemm host_sgemm 64 1 1 2)
test_add(NAME sgemm host_sgemm 64 1 1 4)
test_add(NAME sgemm host_sgemm 64 1 1 8)
test_add(NAME sgemm host_sgemm 64 1 1 16)
test_add(NAME sgemm host_sgemm 64 1 1 32)
test_add(NAME sgemm host_sgemm 64 1 1 64)
test_add(NAME sgemm host_sgemm 128 1 1 1)
test_add(NAME sgemm host_sgemm 128 1 1 2)
test_add(NAME sgemm host_sgemm 128 1 1 4)
test_add(NAME sgemm host_sgemm 128 1 1 8)
test_add(NAME sgemm host_sgemm 128 1 1 16)
test_add(NAME sgemm host_sgemm 128 1 1 32)
test_add(NAME sgemm host_sgemm 128 1 1 64)
test_add(NAME sgemm host_sgemm 128 1 1 128)
test_add(NAME sgemm host_sgemm 256 1 1 1)
test_add(NAME sgemm host_sgemm 256 1 1 2)
test_add(NAME sgemm host_sgemm 256 1 1 4)
test_add(NAME sgemm host_sgemm 256 1 1 8)
test_add(NAME sgemm host_sgemm 256 1 1 16)
test_add(NAME sgemm host_sgemm 256 1 1 32)
test_add(NAME sgemm host_sgemm 256 1 1 64)
test_add(NAME sgemm host_sgemm 256 1 1 128)
test_add(NAME sgemm host_sgemm 256 1 1 256)

# DPCPP interoperability tests
test_add(NAME simple-dpcpp    TEST_IS_DPCPP host_simple-dpcpp)
test_add(NAME simple-dpcpp-l0 TEST_IS_DPCPP host_simple-dpcpp-l0)
test_add(NAME pipeline-dpcpp  TEST_IS_DPCPP host_pipeline-dpcpp)
test_add(NAME simple-esimd    TEST_IS_DPCPP simple-esimd --gpu)
test_add(NAME simple-esimd    TEST_IS_DPCPP simple-esimd --cpu)
test_add(NAME vadd-esimd      TEST_IS_DPCPP DPCPP_SPV "vadd-esimd_ispc2esimd.spv" vadd-esimd)
test_add(NAME callback-esimd  TEST_IS_DPCPP DPCPP_SPV "callback-esimd_ispc2esimd.spv" callback-esimd --cpu)
test_add(NAME callback-esimd  TEST_IS_DPCPP DPCPP_SPV "callback-esimd_ispc2esimd.spv" callback-esimd --gpu)
# ISPC->DPC++ interop tests
# The order of tests is important. invoke_sycl_aobench_ispc produces validation image for other two.
test_add(NAME invoke-sycl-aobench TEST_IS_DPCPP invoke_sycl_aobench_ispc)
test_add(NAME invoke-sycl-aobench TEST_IS_DPCPP IGC_SIMD 16 RES_IMAGE "ao_sycl_reference_4.ppm" REF_IMAGE "ao_ispc_4.ppm" IMAGE_CMP_TH "0.002" aobench_sycl_bin)
test_add(NAME invoke-sycl-aobench TEST_IS_DPCPP TEST_IS_INVOKE_SYCL IGC_SIMD 16 RES_IMAGE "ao_sycl_4.ppm" REF_IMAGE "ao_ispc_4.ppm" IMAGE_CMP_TH "0.002" invoke_sycl_aobench_ispc_sycl_bin)
test_add(NAME invoke-sycl-aobench TEST_IS_DPCPP TEST_IS_INVOKE_SYCL IGC_SIMD 16 RES_IMAGE "ao_sycl_4.ppm" REF_IMAGE "ao_ispc_4.ppm" IMAGE_CMP_TH "0.002" invoke_sycl_aobench_ispc_sycl_visa)
# DPC++->ISPC interop tests
test_add(NAME invoke-simd-vadd TEST_IS_DPCPP TEST_IS_INVOKE_SIMD IGC_SIMD 16 DPCPP_SPV "invoke_simd_vadd_ispc2dpcpp.spv" invoke_simd_vadd)

# perf tests
test_add(NAME sgemm host_sgemm 128 100 1 4)
test_add(NAME sgemm host_sgemm 128 100 1 8)
test_add(NAME sgemm host_sgemm 128 100 2 8)
test_add(NAME sgemm host_sgemm 256 100 1 4)

#test_add(NAME sgemm host_sgemm 32 100 1 1)
#test_add(NAME sgemm host_sgemm 32 100 1 2)
#test_add(NAME sgemm host_sgemm 32 100 1 4)
#test_add(NAME sgemm host_sgemm 32 100 1 8)
#test_add(NAME sgemm host_sgemm 32 100 1 16)
#test_add(NAME sgemm host_sgemm 32 100 1 32)
#test_add(NAME sgemm host_sgemm 64 100 1 1)
#test_add(NAME sgemm host_sgemm 64 100 1 2)
#test_add(NAME sgemm host_sgemm 64 100 1 4)
#test_add(NAME sgemm host_sgemm 64 100 1 8)
#test_add(NAME sgemm host_sgemm 64 100 1 16)
#test_add(NAME sgemm host_sgemm 64 100 1 32)
#test_add(NAME sgemm host_sgemm 64 100 1 64)
#test_add(NAME sgemm host_sgemm 128 100 1 1)
#test_add(NAME sgemm host_sgemm 128 100 1 2)
#test_add(NAME sgemm host_sgemm 128 100 1 4)
#test_add(NAME sgemm host_sgemm 128 100 1 8)
#test_add(NAME sgemm host_sgemm 128 100 1 16)
#test_add(NAME sgemm host_sgemm 128 100 1 32)
#test_add(NAME sgemm host_sgemm 128 100 1 64)
#test_add(NAME sgemm host_sgemm 128 100 1 128)
#test_add(NAME sgemm host_sgemm 256 100 1 1)
#test_add(NAME sgemm host_sgemm 256 100 1 2)
#test_add(NAME sgemm host_sgemm 256 100 1 4)
#test_add(NAME sgemm host_sgemm 256 100 1 8)
#test_add(NAME sgemm host_sgemm 256 100 1 16)
#test_add(NAME sgemm host_sgemm 256 100 1 32)
#test_add(NAME sgemm host_sgemm 256 100 1 64)
#test_add(NAME sgemm host_sgemm 256 100 1 128)
#test_add(NAME sgemm host_sgemm 256 100 1 256)

