fix: add explicit RDMA build constraints

Gate native RDMA, cuObject, and cuobjclient implementations behind the
rdma build tag while keeping fallback stubs available for standard builds.
Preserve the separate cuobjclient_host configuration, clarify unsupported
platform errors, and update Makefile RDMA targets to pass the required tags
and disable VCS stamping.

Co-authored-by: Ben McClelland <ben.mcclelland@versity.com>
This commit is contained in:
Eric Entzel
2026-09-15 11:03:51 -07:00
committed by Ben McClelland
co-authored by Ben McClelland
parent 4dc0debf8f
commit 3610eddf40
23 changed files with 33 additions and 29 deletions
+8 -4
View File
@@ -111,7 +111,7 @@ vgwrdma: $(VGWRDMA_WRAPPER_LIB) $(RCSERVER_LIB)
CGO_ENABLED=1 \
CGO_CFLAGS="$(VGWRDMA_RDMA_CGO_CFLAGS)" \
CGO_LDFLAGS="$(VGWRDMA_RDMA_CGO_LDFLAGS)" \
$(GOBUILD) -buildvcs=false $(LDFLAGS) -o $(VGWRDMA_BIN) $(VGWRDMA_CMD)
$(GOBUILD) -buildvcs=false -tags rdma $(LDFLAGS) -o $(VGWRDMA_BIN) $(VGWRDMA_CMD)
.PHONY: cuobjtest
cuobjtest: cuobjtest-gpu
@@ -121,12 +121,12 @@ cuobjtest-gpu: $(CUOBJCLIENT_WRAPPER_LIB)
CGO_ENABLED=1 \
CGO_CFLAGS="$(CUOBJCLIENT_CGO_CFLAGS)" \
CGO_LDFLAGS="$(CUOBJCLIENT_CGO_LDFLAGS)" \
$(GOBUILD) -buildvcs=false $(LDFLAGS) -o $(CUOBJTEST_BIN) $(CUOBJTEST_CMD)
$(GOBUILD) -buildvcs=false -tags rdma $(LDFLAGS) -o $(CUOBJTEST_BIN) $(CUOBJTEST_CMD)
.PHONY: cuobjtest-host
cuobjtest-host: $(HOSTCLIENT_WRAPPER_LIB)
CGO_ENABLED=1 \
$(GOBUILD) -buildvcs=false -tags $(CUOBJTEST_HOST_TAG) $(LDFLAGS) -o $(CUOBJTEST_BIN) $(CUOBJTEST_CMD)
$(GOBUILD) -buildvcs=false -tags "rdma $(CUOBJTEST_HOST_TAG)" $(LDFLAGS) -o $(CUOBJTEST_BIN) $(CUOBJTEST_CMD)
.PHONY: vgwrdma-builder-image
vgwrdma-builder-image:
@@ -160,9 +160,13 @@ testbin:
$(GOBUILD) $(LDFLAGS) -o $(BIN) -cover -race cmd/$(BIN)/*.go
.PHONY: test
test:
test:
$(GOTEST) ./...
.PHONY: rdmatest
rdmatest: $(VGWRDMA_WRAPPER_LIB) $(CUOBJCLIENT_WRAPPER_LIB) $(HOSTCLIENT_WRAPPER_LIB) $(RCSERVER_LIB)
$(GOTEST) -tags rdma ./...
.PHONY: check
check:
# note this requires staticcheck be in your PATH:
+1 -1
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
package cubackend
+1 -1
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build !(linux && amd64 && cgo)
//go:build !(linux && amd64 && cgo && rdma)
package cubackend
+1 -1
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build linux && amd64 && cgo && cuobjclient_host
//go:build linux && amd64 && cgo && rdma && cuobjclient_host
// This file implements the cuObjClient Session API on top of the host-memory
// RDMA client (package rdma/hostclient). It contains no CUDA/GPU dependency and
+1 -1
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build linux && amd64 && cgo && !cuobjclient_host
//go:build linux && amd64 && cgo && rdma && !cuobjclient_host
package cuobjclient
+4 -4
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build !(linux && amd64 && cgo)
//go:build !(linux && amd64 && cgo && rdma)
package cuobjclient
@@ -37,7 +37,7 @@ func NewSession(size int) (*Session, error) {
if size > MaxTransferSize {
return nil, fmt.Errorf("invalid size %d: exceeds MaxTransferSize (%d)", size, MaxTransferSize)
}
return nil, fmt.Errorf("cuobjclient: NewSession is only supported on linux/amd64 with cgo")
return nil, fmt.Errorf("cuobjclient: NewSession is only supported on linux/amd64 with cgo and the rdma build tag")
}
// Close is a no-op in the unsupported-platform stub.
@@ -52,7 +52,7 @@ func (s *Session) Upload(base *s3lib.Client, bucket, key string, src []byte) err
_ = bucket
_ = key
_ = src
return fmt.Errorf("cuobjclient: Upload is only supported on linux/amd64 with cgo")
return fmt.Errorf("cuobjclient: Upload is only supported on linux/amd64 with cgo and the rdma build tag")
}
// Download always returns an unsupported-platform error on this build.
@@ -62,5 +62,5 @@ func (s *Session) Download(base *s3lib.Client, bucket, key string, dst []byte) e
_ = bucket
_ = key
_ = dst
return fmt.Errorf("cuobjclient: Download is only supported on linux/amd64 with cgo")
return fmt.Errorf("cuobjclient: Download is only supported on linux/amd64 with cgo and the rdma build tag")
}
+1 -1
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
// This file holds the S3 request plumbing shared by the GPU (session_linux.go)
// and host-memory (session_host_linux.go) session implementations: both issue
+1 -1
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
// Package hostclient implements the client side of the cuObject RDMA DC
// protocol using libibverbs + mlx5 direct verbs, with no CUDA/GPU dependency.
+1 -1
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build !(linux && amd64 && cgo)
//go:build !(linux && amd64 && cgo && rdma)
// Package hostclient is stubbed on platforms without RDMA verbs support.
package hostclient
+1 -1
View File
@@ -14,7 +14,7 @@
// under the License.
// Admin session snapshot route for the RC data plane.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
package rcroutes
+1 -1
View File
@@ -15,7 +15,7 @@
// Admin session snapshot route (stub for platforms without RDMA
// support).
//go:build !(linux && amd64 && cgo)
//go:build !(linux && amd64 && cgo && rdma)
package rcroutes
+1 -1
View File
@@ -11,7 +11,7 @@
// express or implied. See the License for the specific language
// governing permissions and limitations under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
package rcroutes
+1 -1
View File
@@ -11,7 +11,7 @@
// express or implied. See the License for the specific language
// governing permissions and limitations under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
package rcroutes
+1 -1
View File
@@ -11,7 +11,7 @@
// express or implied. See the License for the specific language
// governing permissions and limitations under the License.
//go:build !(linux && amd64 && cgo)
//go:build !(linux && amd64 && cgo && rdma)
package rcroutes
+1 -1
View File
@@ -13,7 +13,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
package rcroutes
+1 -1
View File
@@ -13,7 +13,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
package rcroutes
+1 -1
View File
@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions
// and limitations under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
// Package rcroutes serves the /.hipobj-rc/{prepare,ready,cancel}
// terminal routes of the hipobj-rc-v2 two-phase transfer protocol.
+1 -1
View File
@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions
// and limitations under the License.
//go:build !(linux && amd64 && cgo)
//go:build !(linux && amd64 && cgo && rdma)
// Package rcroutes serves the /.hipobj-rc control routes of the
// hipobj-rc-v2 two-phase transfer protocol. This file is a stub
+1 -1
View File
@@ -13,7 +13,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build linux && cgo
//go:build linux && amd64 && cgo && rdma
package rcserver
+1 -1
View File
@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions
// and limitations under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
// Package rcserver binds the RC session server (rdma/librcserver.a)
// that implements the hipobj-rc-v2 two-phase transfer protocol.
+1 -1
View File
@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions
// and limitations under the License.
//go:build !(linux && amd64 && cgo)
//go:build !(linux && amd64 && cgo && rdma)
// Package rcserver binds the RC session server implementing the
// hipobj-rc-v2 two-phase transfer protocol. This file is a stub for
+1 -1
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build linux && amd64 && cgo
//go:build linux && amd64 && cgo && rdma
// Package rdma provides Go bindings to libcuobjserver via CGO.
package rdma
+1 -1
View File
@@ -12,7 +12,7 @@
// specific language governing permissions and limitations
// under the License.
//go:build !(linux && amd64 && cgo)
//go:build !(linux && amd64 && cgo && rdma)
// Package rdma provides Go bindings to libcuobjserver.
// This file is a stub for platforms without RDMA support.