Skip to content

Commit

Permalink
feat: add gcov code coverage support (#3010)
Browse files Browse the repository at this point in the history
Ability to pass the `CODE_COVERAGE=yes` option to `make`, which, when
used with the `icx` compiler, adds the necessary build and link flags.
Generates `.gcno` files during the build process.

note: `llvm-cov gcov` should be used to collect coverage information
  • Loading branch information
homksei authored Dec 9, 2024
1 parent 36803e0 commit bc1de4d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dev/make/compiler_definitions/dpcpp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ COMPILER.win.dpcpp = icx -fsycl $(if $(MSVC_RT_is_release),-MD, -MDd /debug:none
-Wno-deprecated-declarations -fsycl-device-code-split=per_kernel

link.dynamic.lnx.dpcpp = icpx -fsycl -m64 -fsycl-device-code-split=per_kernel -fsycl-max-parallel-link-jobs=$(SYCL_LINK_PRL)
link.dynamic.lnx.dpcpp += $(if $(filter yes,$(GCOV_ENABLED)),-Xscoverage,)

link.dynamic.win.dpcpp = icx -fsycl -m64 -fsycl-device-code-split=per_kernel -fsycl-max-parallel-link-jobs=$(SYCL_LINK_PRL)

pedantic.opts.lnx.dpcpp = -pedantic \
Expand Down
3 changes: 2 additions & 1 deletion dev/make/compiler_definitions/icx.mkl.32e.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ CORE.SERV.COMPILER.icx = generic

COMPILER.lnx.icx = icx -m64 \
-Werror -Wreturn-type -qopenmp-simd

COMPILER.lnx.icx += $(if $(filter yes,$(GCOV_ENABLED)),-coverage,)
COMPILER.win.icx = icx $(if $(MSVC_RT_is_release),-MD -Qopenmp-simd, -MDd) -nologo -WX -Wno-deprecated-declarations

link.dynamic.lnx.icx = icx -m64 -no-intel-lib
link.dynamic.lnx.icx += $(if $(filter yes,$(GCOV_ENABLED)),-coverage,)

pedantic.opts.lnx.icx = -pedantic \
-Wall \
Expand Down
2 changes: 2 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ PLAT_is_$(PLAT) := yes
MSVC_RT_is_$(MSVC_RUNTIME_VERSION) := yes
ARCH_is_$(ARCH) := yes

GCOV_ENABLED := $(if $(filter yes,$(CODE_COVERAGE)),$(if $(OS_is_lnx),yes,no),no)

DEFAULT_BUILD_PARAMETERS_LIB := $(if $(OS_is_win),no,yes)
BUILD_PARAMETERS_LIB ?= $(DEFAULT_BUILD_PARAMETERS_LIB)

Expand Down

0 comments on commit bc1de4d

Please sign in to comment.