Skip to content

Commit

Permalink
Resurect the WORKSPACE file and add an empty WORKSPACE.bzlmod so …
Browse files Browse the repository at this point in the history
…that the build works with both older and newer version of `bazel` followin the approach described [here](https://bazel.build/external/migration#hybrid-mode).

This should fix #7630.

PiperOrigin-RevId: 716673350
  • Loading branch information
gonnet authored and xnnpack-bot committed Jan 17, 2025
1 parent a20f7eb commit b7e77bc
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 6 deletions.
20 changes: 14 additions & 6 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright 2025 Google LLC
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# Description:
# XNNPACK - optimized floating-point neural network operators library

## MODULE.bazel
module(
name = "xnnpack",
Expand Down Expand Up @@ -37,7 +45,7 @@ http_archive(
strip_prefix = "googletest-d144031940543e15423a25ae5a8a74141044862f",
urls = ["https://github.com/google/googletest/archive/d144031940543e15423a25ae5a8a74141044862f.zip"],
)
# LINT.ThenChange(cmake/DownloadGoogleTest.cmake)
# LINT.ThenChange(cmake/DownloadGoogleTest.cmake,WORKSPACE:googletest)

# LINT.IfChange(benchmark)
# Google Benchmark library, used in micro-benchmarks.
Expand All @@ -47,7 +55,7 @@ http_archive(
strip_prefix = "benchmark-d2a8a4ee41b923876c034afb939c4fc03598e622",
urls = ["https://github.com/google/benchmark/archive/d2a8a4ee41b923876c034afb939c4fc03598e622.zip"],
)
# LINT.ThenChange(cmake/DownloadGoogleBenchmark.cmake)
# LINT.ThenChange(cmake/DownloadGoogleBenchmark.cmake,WORKSPACE:benchmark)

# LINT.IfChange(FXdiv)
# FXdiv library, used for repeated integer division by the same factor
Expand All @@ -57,7 +65,7 @@ http_archive(
strip_prefix = "FXdiv-b408327ac2a15ec3e43352421954f5b1967701d1",
urls = ["https://github.com/Maratyszcza/FXdiv/archive/b408327ac2a15ec3e43352421954f5b1967701d1.zip"],
)
# LINT.ThenChange(cmake/DownloadFXdiv.cmake)
# LINT.ThenChange(cmake/DownloadFXdiv.cmake,WORKSPACE:FXdiv)

# LINT.IfChange(pthreadpool)
# pthreadpool library, used for parallelization
Expand All @@ -67,7 +75,7 @@ http_archive(
strip_prefix = "pthreadpool-39df650e19d4f6382e246c29d6819b1ce6ee0b24",
urls = ["https://github.com/google/pthreadpool/archive/39df650e19d4f6382e246c29d6819b1ce6ee0b24.zip"],
)
# LINT.ThenChange(cmake/DownloadPThreadPool.cmake)
# LINT.ThenChange(cmake/DownloadPThreadPool.cmake,WORKSPACE:pthreadpool)

# LINT.IfChange(cpuinfo)
# cpuinfo library, used for detecting processor characteristics
Expand All @@ -79,7 +87,7 @@ http_archive(
"https://github.com/pytorch/cpuinfo/archive/8a1772a0c5c447df2d18edf33ec4603a8c9c04a6.zip",
],
)
# LINT.ThenChange(cmake/DownloadCpuinfo.cmake)
# LINT.ThenChange(cmake/DownloadCpuinfo.cmake,WORKSPACE:cpuinfo)

# LINT.IfChange(kleidiai)
# KleidiAI library, used for ARM microkernels.
Expand All @@ -91,7 +99,7 @@ http_archive(
"https://gitlab.arm.com/kleidi/kleidiai/-/archive/d15722976120710080ca098fe8ddabf4556cb40f/kleidiai-d15722976120710080ca098fe8ddabf4556cb40f.zip",
],
)
# LINT.ThenChange(cmake/DownloadKleidiAI.cmake)
# LINT.ThenChange(cmake/DownloadKleidiAI.cmake,WORKSPACE:kleidiai)

# Ruy library, used to benchmark against
http_archive(
Expand Down
125 changes: 125 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Copyright 2025 Google LLC
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# Description:
# XNNPACK - optimized floating-point neural network operators library

workspace(name = "xnnpack")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Bazel rule definitions
http_archive(
name = "rules_cc",
sha256 = "3868eab488bd5be37a6acedbd222a196bea14408a2857916f33cce7b4780897d",
strip_prefix = "rules_cc-5e848c1434d3458018734238dbc4781f43992ea5",
urls = [
"https://github.com/bazelbuild/rules_cc/archive/5e848c1434d3458018734238dbc4781f43992ea5.zip",
],
)

# Bazel Python rule definitions.
http_archive(
name = "rules_python",
sha256 = "4912ced70dc1a2a8e4b86cec233b192ca053e82bc72d877b98e126156e8f228d",
strip_prefix = "rules_python-0.32.2",
urls = [
"https://github.com/bazelbuild/rules_python/releases/download/0.32.2/rules_python-0.32.2.tar.gz",
],
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

# Bazel Skylib.
http_archive(
name = "bazel_skylib",
sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
],
)

# Bazel Platforms
http_archive(
name = "platforms",
sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
urls = ["https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz"],
)

# LINT.IfChange(googletest)
# Google Test framework, used by most unit-tests.
http_archive(
name = "com_google_googletest",
sha256 = "648b9430fca63acc68c59ee98f624dcbcd9c24ea6b278c306ab6b7f49f62034a",
strip_prefix = "googletest-d144031940543e15423a25ae5a8a74141044862f",
urls = ["https://github.com/google/googletest/archive/d144031940543e15423a25ae5a8a74141044862f.zip"],
)
# LINT.ThenChange(cmake/DownloadGoogleTest.cmake,MODULE.bazel:googletest)

# LINT.IfChange(benchmark)
# Google Benchmark library, used in micro-benchmarks.
http_archive(
name = "com_google_benchmark",
sha256 = "1ba14374fddcd9623f126b1a60945e4deac4cdc4fb25a5f25e7f779e36f2db52",
strip_prefix = "benchmark-d2a8a4ee41b923876c034afb939c4fc03598e622",
urls = ["https://github.com/google/benchmark/archive/d2a8a4ee41b923876c034afb939c4fc03598e622.zip"],
)
# LINT.ThenChange(cmake/DownloadGoogleBenchmark.cmake,MODULE.bazel:benchmark)

# LINT.IfChange(FXdiv)
# FXdiv library, used for repeated integer division by the same factor
http_archive(
name = "FXdiv",
sha256 = "ab7dfb08829bee33dca38405d647868fb214ac685e379ec7ef2bebcd234cd44d",
strip_prefix = "FXdiv-b408327ac2a15ec3e43352421954f5b1967701d1",
urls = ["https://github.com/Maratyszcza/FXdiv/archive/b408327ac2a15ec3e43352421954f5b1967701d1.zip"],
)
# LINT.ThenChange(cmake/DownloadFXdiv.cmake,MODULE.bazel:FXdiv)

# LINT.IfChange(pthreadpool)
# pthreadpool library, used for parallelization
http_archive(
name = "pthreadpool",
sha256 = "9f1baba9e97df8abc792eeaa2a8f0e0d29e507db1b4c1a8210868c889eb449b5",
strip_prefix = "pthreadpool-39df650e19d4f6382e246c29d6819b1ce6ee0b24",
urls = ["https://github.com/google/pthreadpool/archive/39df650e19d4f6382e246c29d6819b1ce6ee0b24.zip"],
)
# LINT.ThenChange(cmake/DownloadPThreadPool.cmake,MODULE.bazel:pthreadpool)

# LINT.IfChange(cpuinfo)
# cpuinfo library, used for detecting processor characteristics
http_archive(
name = "cpuinfo",
sha256 = "4bf314b3f04db2fd984fef38a7e278e702b74297ef0af592b73296edba02b9d4",
strip_prefix = "cpuinfo-8a1772a0c5c447df2d18edf33ec4603a8c9c04a6",
urls = [
"https://github.com/pytorch/cpuinfo/archive/8a1772a0c5c447df2d18edf33ec4603a8c9c04a6.zip",
],
)
# LINT.ThenChange(cmake/DownloadCpuinfo.cmake,MODULE.bazel:cpuinfo)

# LINT.IfChange(kleidiai)
# KleidiAI library, used for ARM microkernels.
http_archive(
name = "KleidiAI",
sha256 = "8857da33291f42e305efcdb2895a787cb4998a7ee1c1d754ef33db74de45cc94",
strip_prefix = "kleidiai-d15722976120710080ca098fe8ddabf4556cb40f",
urls = [
"https://gitlab.arm.com/kleidi/kleidiai/-/archive/d15722976120710080ca098fe8ddabf4556cb40f/kleidiai-d15722976120710080ca098fe8ddabf4556cb40f.zip",
],
)
# LINT.ThenChange(cmake/DownloadKleidiAI.cmake,MODULE.bazel:kleidiai)

# Ruy library, used to benchmark against
http_archive(
name = "ruy",
sha256 = "fe8345f521bb378745ebdd0f8c5937414849936851d2ec2609774eb2d7098e54",
strip_prefix = "ruy-9f53ba413e6fc879236dcaa3e008915973d67a4f",
urls = [
"https://github.com/google/ruy/archive/9f53ba413e6fc879236dcaa3e008915973d67a4f.zip",
],
9 changes: 9 additions & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2025 Google LLC
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# Description:
# XNNPACK - optimized floating-point neural network operators library

# This file intentionally left blank (see https://bazel.build/external/migration#hybrid-mode).

0 comments on commit b7e77bc

Please sign in to comment.