Skip to content

Commit 67bba31

Browse files
authored
Merge pull request #987 from Cyan4973/libxxh_dispatch
LIBXXH_DISPATCH: control runtime vector dispatch in `libxxhash`
2 parents 8aa8944 + 9ff12f6 commit 67bba31

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ $(LIBXXH): LDFLAGS += -shared
151151
ifeq (,$(filter Windows%,$(OS)))
152152
$(LIBXXH): CFLAGS += -fPIC
153153
endif
154-
ifeq ($(DISPATCH),1)
154+
ifeq ($(LIBXXH_DISPATCH),1)
155155
$(LIBXXH): xxh_x86dispatch.c
156156
endif
157157
$(LIBXXH): xxhash.c
@@ -632,7 +632,7 @@ install_libxxhash.includes:
632632
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR) # includes
633633
$(Q)$(INSTALL_DATA) xxhash.h $(DESTDIR)$(INCLUDEDIR)
634634
$(Q)$(INSTALL_DATA) xxh3.h $(DESTDIR)$(INCLUDEDIR) # for compatibility, will be removed in v0.9.0
635-
ifeq ($(DISPATCH),1)
635+
ifeq ($(LIBXXH_DISPATCH),1)
636636
$(Q)$(INSTALL_DATA) xxh_x86dispatch.h $(DESTDIR)$(INCLUDEDIR)
637637
endif
638638

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ The following macros can be set at compilation time to modify `libxxhash`'s beha
170170
#### Makefile variables
171171
When compiling the Command Line Interface `xxhsum` using `make`, the following environment variables can also be set :
172172
- `DISPATCH=1` : use `xxh_x86dispatch.c`, select at runtime between `scalar`, `sse2`, `avx2` or `avx512` instruction set. This option is only valid for `x86`/`x64` systems. It is enabled by default when target `x86`/`x64` is detected. It can be forcefully turned off using `DISPATCH=0`.
173+
- `LIBXXH_DISPATCH=1` : same idea, implemented a runtime vector extension detector, but within `libxxhash`. This parameter is disabled by default. When enabled (only valid for `x86`/`x64` systems), new symbols published in `xxh_x86dispatch.h` become accessible. At the time of this writing, it's required to include `xxh_x86dispatch.h` in order to access the symbols with runtime vector extension detection.
173174
- `XXH_1ST_SPEED_TARGET` : select an initial speed target, expressed in MB/s, for the first speed test in benchmark mode. Benchmark will adjust the target at subsequent iterations, but the first test is made "blindly" by targeting this speed. Currently conservatively set to 10 MB/s, to support very slow (emulated) platforms.
174175
- `NODE_JS=1` : When compiling `xxhsum` for Node.js with Emscripten, this links the `NODERAWFS` library for unrestricted filesystem access and patches `isatty` to make the command line utility correctly detect the terminal. This does make the binary specific to Node.js.
175176

0 commit comments

Comments
 (0)