Skip to content

Commit d03fb25

Browse files
garrettgu10fhanau
authored andcommitted
Move fp16 dependency to Bazel & patch v8
1 parent 0842e5e commit d03fb25

3 files changed

+58
-2
lines changed

WORKSPACE

+9-1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ git_repository(
190190
remote = "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git",
191191
)
192192

193+
git_repository(
194+
name = "fp16",
195+
commit = "0a92994d729ff76a58f692d3028ca1b64b145d91",
196+
build_file_content = "exports_files(glob([\"**\"]))",
197+
remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git"
198+
)
199+
193200
# Bindings for abseil libraries used by V8
194201
[
195202
bind(
@@ -449,7 +456,8 @@ http_archive(
449456
"//:patches/v8/0012-Always-enable-continuation-preserved-data-in-the-bui.patch",
450457
"//:patches/v8/0013-increase-visibility-of-virtual-method.patch",
451458
"//:patches/v8/0014-Add-ValueSerializer-SetTreatFunctionsAsHostObjects.patch",
452-
"//:patches/v8/0015-Set-torque-generator-path-to-external-v8.-This-allow.patch"
459+
"//:patches/v8/0015-Set-torque-generator-path-to-external-v8.-This-allow.patch",
460+
"//:patches/v8/0016-Modify-where-to-look-for-fp16-dependency.-This-depen.patch"
453461
],
454462
integrity = "sha256-C6bsXXbKgeCxmG1VNO/LScaPq0HVlmofpVHJ5kswoLg=",
455463
strip_prefix = "v8-12.4.254.11",

patches/v8/0015-Set-torque-generator-path-to-external-v8.-This-allow.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ index e55defede9fed3eea9348bd7bd50d98f688a2a7b..faeef2b2ed71b4784050451a61a16feb
1717
def _torque_files_impl(ctx):
1818
- v8root = "."
1919
+ v8root = "external/v8"
20-
20+
2121
# Arguments
2222
args = []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From b8c3575ff696eac20bd8d94f49407b52642087c1 Mon Sep 17 00:00:00 2001
2+
From: Garrett Gu <[email protected]>
3+
Date: Mon, 22 Apr 2024 10:10:21 -0500
4+
Subject: Modify where to look for fp16 dependency. This dependency is normally
5+
downloaded by gn but we need to fetch it in Bazel. We do so in the workerd
6+
repo in the WORKSPACE file.
7+
8+
---
9+
BUILD.bazel | 26 ++++++++++++++++----------
10+
1 file changed, 16 insertions(+), 10 deletions(-)
11+
12+
diff --git a/BUILD.bazel b/BUILD.bazel
13+
index f3e7958b39e5b7e42b06fad83a0bf6f7352ffd3c..e1fed34c700e88cb7a54450d0f2c7cb34c6c921f 100644
14+
--- a/BUILD.bazel
15+
+++ b/BUILD.bazel
16+
@@ -3689,16 +3689,22 @@ filegroup(
17+
}),
18+
)
19+
20+
-v8_library(
21+
- name = "lib_fp16",
22+
- srcs = ["third_party/fp16/src/include/fp16.h"],
23+
- hdrs = [
24+
- "third_party/fp16/src/include/fp16/fp16.h",
25+
- "third_party/fp16/src/include/fp16/bitcasts.h",
26+
- ],
27+
- includes = [
28+
- "third_party/fp16/src/include",
29+
- ],
30+
+cc_library(
31+
+ name = "lib_fp16",
32+
+ hdrs = [
33+
+ "@fp16//:include/fp16.h",
34+
+ ],
35+
+ include_prefix = "third_party/fp16/src",
36+
+ deps = [":lib_fp16_includes"],
37+
+)
38+
+
39+
+cc_library(
40+
+ name = "lib_fp16_includes",
41+
+ hdrs = [
42+
+ "@fp16//:include/fp16/bitcasts.h",
43+
+ "@fp16//:include/fp16/fp16.h",
44+
+ ],
45+
+ strip_include_prefix = "include",
46+
)
47+
48+
filegroup(

0 commit comments

Comments
 (0)