Skip to content

Add ITTAPI source for offline #49022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ WITH_GC_DEBUG_ENV := 0
# Enable DTrace support
WITH_DTRACE := 0

# Enable ITTAPI integration
WITH_ITTAPI := 0

# Enable Tracy support
WITH_TRACY := 0

Expand Down Expand Up @@ -728,6 +731,12 @@ JCFLAGS += -DUSE_DTRACE
DTRACE := dtrace
endif

ifeq ($(WITH_ITTAPI), 1)
JCXXFLAGS += -DUSE_ITTAPI
JCFLAGS += -DUSE_ITTAPI
LIBITTAPI:=-littnotify
endif

ifeq ($(WITH_TRACY), 1)
JCXXFLAGS += -DUSE_TRACY -DTRACY_ENABLE
JCFLAGS += -DUSE_TRACY -DTRACY_ENABLE
Expand Down
4 changes: 4 additions & 0 deletions THIRDPARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ own licenses:
- [LLVM](https://releases.llvm.org/12.0.1/LICENSE.TXT) [APACHE 2.0 with LLVM Exception]
- [UTF8PROC](https://github.com/JuliaStrings/utf8proc) [MIT]

and optionally:

- [ITTAPI](https://github.com/intel/ittapi/blob/master/LICENSES/BSD-3-Clause.txt) [BSD-3]

Julia's `stdlib` uses the following external libraries, which have their own licenses:

- [DSFMT](https://github.com/MersenneTwister-Lab/dSFMT/blob/master/LICENSE.txt) [BSD-3]
Expand Down
2 changes: 1 addition & 1 deletion contrib/refresh_checksums.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ BB_PROJECTS=mbedtls libssh2 nghttp2 mpfr curl libgit2 pcre libuv unwind llvmunwi
BB_GCC_EXPANDED_PROJECTS=openblas csl
BB_CXX_EXPANDED_PROJECTS=gmp llvm clang llvm-tools lld
# These are non-BB source-only deps
NON_BB_PROJECTS=patchelf mozillacert lapack libwhich utf8proc
NON_BB_PROJECTS=patchelf mozillacert lapack libwhich utf8proc ittapi

ifneq ($(VERBOSE),1)
QUIET_MAKE := -s
Expand Down
13 changes: 12 additions & 1 deletion deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ ifeq ($(USE_SYSTEM_P7ZIP), 0)
DEP_LIBS += p7zip
endif

ifeq ($(USE_INTEL_JITEVENTS), 1)
ifeq ($(USE_BINARYBUILDER_LLVM), 0)
DEP_LIBS += ittapi
endif
endif

ifeq ($(WITH_ITTAPI),1)
DEP_LIBS += ittapi
endif


# Only compile standalone LAPACK if we are not using OpenBLAS.
# OpenBLAS otherwise compiles LAPACK as part of its build.
Expand All @@ -178,7 +188,7 @@ DEP_LIBS_STAGED := $(DEP_LIBS)
DEP_LIBS_STAGED_ALL := llvm llvm-tools clang llvmunwind unwind libuv pcre \
openlibm dsfmt blastrampoline openblas lapack gmp mpfr patchelf utf8proc \
objconv mbedtls libssh2 nghttp2 curl libgit2 libwhich zlib p7zip csl \
libsuitesparse lld libtracyclient
libsuitesparse lld libtracyclient ittapi
DEP_LIBS_ALL := $(DEP_LIBS_STAGED_ALL)

ifneq ($(USE_BINARYBUILDER_OPENBLAS),0)
Expand Down Expand Up @@ -213,6 +223,7 @@ distcleanall: $(addprefix distclean-, $(DEP_LIBS_ALL))
getall: $(addprefix get-, $(DEP_LIBS_ALL))

include $(SRCDIR)/csl.mk
include $(SRCDIR)/ittapi.mk
include $(SRCDIR)/llvm.mk
include $(SRCDIR)/libuv.mk
include $(SRCDIR)/pcre.mk
Expand Down
2 changes: 2 additions & 0 deletions deps/checksums/ittapi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ittapi-0014aec56fea2f30c1374f40861e1bccdd53d0cb.tar.gz/md5/932501cdb0e1c7841e23c12da7740419
ittapi-0014aec56fea2f30c1374f40861e1bccdd53d0cb.tar.gz/sha512/4dd3343837398ada0cdcdaaff630d8d91738d166897d86b77770facde30da99dbb90931b58a4a887399e6bc9a7a1c245057d0a0f63762230d577d71da871701f
43 changes: 43 additions & 0 deletions deps/ittapi.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## ittapi ##
include $(SRCDIR)/ittapi.version

ITTAPI_GIT_URL := https://github.com/intel/ittapi.git
ITTAPI_TAR_URL = https://api.github.com/repos/intel/ittapi/tarball/$1
$(eval $(call git-external,ittapi,ITTAPI,CMakeLists.txt,,$(SRCCACHE)))

ITTAPI_OPTS := $(CMAKE_COMMON) -DCMAKE_BUILD_TYPE=Release -DITT_API_IPT_SUPPORT= -DITT_API_FORTRAN_SUPPORT=0

$(BUILDDIR)/$(ITTAPI_SRC_DIR)/build-configured: $(SRCCACHE)/$(ITTAPI_SRC_DIR)/source-extracted
mkdir -p $(dir $@)
cd $(dir $@) && \
$(CMAKE) $(dir $<) $(ITTAPI_OPTS)
echo 1 > $@

$(BUILDDIR)/$(ITTAPI_SRC_DIR)/build-compiled: $(BUILDDIR)/$(ITTAPI_SRC_DIR)/build-configured
$(MAKE) -C $(dir $<)
echo 1 > $@

define ITTAPI_INSTALL
mkdir -p $2/$$(build_libdir)
mkdir -p $2/$$(build_includedir)/ittapi
cp -a $1/bin/libittnotify.a $2/$$(build_libdir)
cp -a $1/bin/libjitprofiling.a $2/$$(build_libdir)
# cp -a $1/bin/libadvisor.a $2/$$(build_libdir)
cp -a $(SRCCACHE)/$(ITTAPI_SRC_DIR)/include/ittnotify.h $2/$$(build_includedir)/ittapi/
cp -a $(SRCCACHE)/$(ITTAPI_SRC_DIR)/include/ittnotify-zca.h $2/$$(build_includedir)/ittapi/
cp -a $(SRCCACHE)/$(ITTAPI_SRC_DIR)/include/jitprofiling.h $2/$$(build_includedir)/ittapi/
endef

$(eval $(call staged-install, \
ittapi,$(ITTAPI_SRC_DIR), \
ITTAPI_INSTALL,,,))

get-ittapi: $(ITTAPI_SRC_FILE)
extract-ittapi: $(SRCCACHE)/$(ITTAPI_SRC_DIR)/source-extracted
configure-ittapi: $(BUILDDIR)/$(ITTAPI_SRC_DIR)/build-configured
compile-ittapi: $(BUILDDIR)/$(ITTAPI_SRC_DIR)/build-compiled
fastcheck-ittapi: #none
check-ittapi: #none

clean-ittapi:
-rm -f $(BUILDDIR)/$(ITTAPI_SRC_DIR)/build-compiled $(build_libdir)/libopenlibm.a
3 changes: 3 additions & 0 deletions deps/ittapi.version
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## source build
ITTAPI_BRANCH=v3.24.0
ITTAPI_SHA1=0014aec56fea2f30c1374f40861e1bccdd53d0cb
7 changes: 6 additions & 1 deletion deps/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ ifeq ($(USE_LLVM_SHLIB),1)
LLVM_CMAKE += -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON -DLLVM_LINK_LLVM_DYLIB:BOOL=ON
endif
ifeq ($(USE_INTEL_JITEVENTS), 1)
LLVM_CMAKE += -DLLVM_USE_INTEL_JITEVENTS:BOOL=ON
LLVM_CMAKE += -DLLVM_USE_INTEL_JITEVENTS:BOOL=ON -DITTAPI_SOURCE_DIR=$(SRCCACHE)/$(ITTAPI_SRC_DIR)
endif # USE_INTEL_JITEVENTS

ifeq ($(USE_OPROFILE_JITEVENTS), 1)
Expand Down Expand Up @@ -286,6 +286,11 @@ configure-llvm: $(LLVM_BUILDDIR_withtype)/build-configured
compile-llvm: $(LLVM_BUILDDIR_withtype)/build-compiled
fastcheck-llvm: #none
check-llvm: $(LLVM_BUILDDIR_withtype)/build-checked

ifeq ($(USE_INTEL_JITEVENTS),1)
extract-llvm: $(SRCCACHE)/$(ITTAPI_SRC_DIR)/source-extracted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think this should be:

$(SRCCACHE)/$(LLVM_SRC_DIR)/source-extracted: $(SRCCACHE)/$(ITTAPI_SRC_DIR)/source-extracted

endif

#todo: LLVM make check target is broken on julia.mit.edu (and really slow elsewhere)

else # USE_BINARYBUILDER_LLVM
Expand Down
2 changes: 2 additions & 0 deletions doc/src/devdocs/build/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ uses are listed in [`deps/$(libname).version`](https://github.com/JuliaLang/juli
- **[mbedtls]** — library used for cryptography and transport layer security, used by libssh2
- **[utf8proc]** — a library for processing UTF-8 encoded Unicode strings.
- **[LLVM libunwind]** — LLVM's fork of [libunwind], a library that determines the call-chain of a program.
- **[ITTAPI]** — Intel's Instrumentation and Tracing Technology and Just-In-Time API.

[GNU make]: https://www.gnu.org/software/make
[patch]: https://www.gnu.org/software/patch
Expand Down Expand Up @@ -222,6 +223,7 @@ uses are listed in [`deps/$(libname).version`](https://github.com/JuliaLang/juli
[pkg-config]: https://www.freedesktop.org/wiki/Software/pkg-config/
[powershell]: https://docs.microsoft.com/en-us/powershell/scripting/wmf/overview
[which]: https://carlowood.github.io/which/
[ITTAPI]: https://github.com/intel/ittapi

## Build dependencies

Expand Down