Skip to content
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: 7 additions & 2 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,16 @@ FetchContent_Declare(
SOURCE_SUBDIR
dont-add-this-project-with-add-subdirectory)

set(_patch_file "${CMAKE_CURRENT_SOURCE_DIR}/patches/xgrammar_constexpr.patch")
FetchContent_Declare(
xgrammar
GIT_REPOSITORY https://github.com/mlc-ai/xgrammar
GIT_TAG v0.1.25 # e4e816f5f0fe39f5b1601a17a4552307fa3b70ff
GIT_TAG v0.1.32 # 62e13551b9b63251114894c5ee638564b160dd48
GIT_SHALLOW TRUE
# NOTE: TensorRT-LLM only uses the headers
SOURCE_SUBDIR
dont-add-this-project-with-add-subdirectory)
dont-add-this-project-with-add-subdirectory
PATCH_COMMAND
bash -c "patch -p1 --forward --batch --dry-run -i '${_patch_file}' && \
patch -p1 --forward --batch -i '${_patch_file}' || \
echo 'Patch already applied, skipping.'")
19 changes: 19 additions & 0 deletions 3rdparty/patches/xgrammar_constexpr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/cpp/grammar_functor.cc
+++ b/cpp/grammar_functor.cc
@@ -1750,11 +1750,11 @@
void Apply(Grammar* grammar);
static std::optional<uint64_t> HashSequence(const Grammar& grammar, int32_t sequence_id);

- static const int16_t kNotEndStateFlag = -0x100;
- static const int16_t kEndStateFlag = -0x200;
- static const int16_t kSelfRecursionFlag = -0x300;
- static const int16_t kSimpleCycleFlag = -0x400;
- static const int16_t kUnKnownFlag = -0x500;
+ static constexpr int16_t kNotEndStateFlag = -0x100;
+ static constexpr int16_t kEndStateFlag = -0x200;
+ static constexpr int16_t kSelfRecursionFlag = -0x300;
+ static constexpr int16_t kSimpleCycleFlag = -0x400;
+ static constexpr int16_t kUnKnownFlag = -0x500;

private:
Grammar* grammar_;
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ ordered-set
peft
patchelf
einops
flashinfer-python~=0.6.1
flashinfer-python==0.6.4
opencv-python-headless
xgrammar==0.1.25
xgrammar==0.1.32
llguidance==0.7.29
jsonschema
backoff
Expand Down
2 changes: 1 addition & 1 deletion security_scanning/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies = [
"patchelf (>=0.17.2.4,<0.18.0.0)",
"einops (>=0.8.2,<0.9.0)",
"flashinfer-python (>=0.6.1,<0.7.0)",
"xgrammar (==0.1.25)",
"xgrammar (==0.1.32)",
"llguidance (==0.7.29)",
"jsonschema (>=4.26.0,<5.0.0)",
"backoff (>=2.2.1,<3.0.0)",
Expand Down
Loading