Skip to content

Commit

Permalink
build: add a submodule for CX10 handling just the modules
Browse files Browse the repository at this point in the history
The CX10 module setup is currently very complicated.  The module is
built twice - once via bazel and incorporated into the TensorFlow
library.  The second build is built via Swift for the modules to import
the interfaces into Swift.  In order to build the swift bindings via
SPM, we need to extract the sources.  However, we cannot reorganise the
CX10 subdirectory to enable SPM to filter out just the modules.  As a
result, we create a `CX10Modules` module that is only built when
building with SPM.  CMake builds will ignore this directory, building
the modules from the CX10 directory directly as it can handle the
subdirectory layout.
  • Loading branch information
compnerd committed Jan 5, 2021
1 parent e03ad18 commit a215cc6
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ let package = Package(
.target(
name: "CTensorFlow",
dependencies: []),
.target(
name: "CX10Modules",
dependencies: []),
.target(
name: "TensorFlow",
dependencies: [
"Tensor",
"PythonKit",
"CTensorFlow",
"CX10Modules",
.product(name: "Numerics", package: "swift-numerics"),
],
swiftSettings: [
Expand Down
1 change: 1 addition & 0 deletions Sources/CX10Modules/include/device_wrapper.h
1 change: 1 addition & 0 deletions Sources/CX10Modules/include/module.modulemap
1 change: 1 addition & 0 deletions Sources/CX10Modules/include/xla_tensor_tf_ops.h
1 change: 1 addition & 0 deletions Sources/CX10Modules/include/xla_tensor_wrapper.h
15 changes: 15 additions & 0 deletions Sources/CX10Modules/shim.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2019 The TensorFlow Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

extern int _;

0 comments on commit a215cc6

Please sign in to comment.