From 3610eddf40b5f1abcce3cfede5839c1100290163 Mon Sep 17 00:00:00 2001 From: Eric Entzel Date: Mon, 14 Sep 2026 11:49:13 -0500 Subject: [PATCH] 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 --- Makefile | 12 ++++++++---- cubackend/cuserver.go | 2 +- cubackend/cuserver_stub.go | 2 +- cuobjclient/session_host_linux.go | 2 +- cuobjclient/session_linux.go | 2 +- cuobjclient/session_stub.go | 8 ++++---- cuobjclient/transport.go | 2 +- rdma/hostclient/client_linux.go | 2 +- rdma/hostclient/client_stub.go | 2 +- rdma/rcroutes/admin_linux.go | 2 +- rdma/rcroutes/admin_stub.go | 2 +- rdma/rcroutes/errors_linux.go | 2 +- rdma/rcroutes/errors_mapping_linux_test.go | 2 +- rdma/rcroutes/errors_stub.go | 2 +- rdma/rcroutes/ops_linux.go | 2 +- rdma/rcroutes/ops_linux_test.go | 2 +- rdma/rcroutes/routes_linux.go | 2 +- rdma/rcroutes/routes_stub.go | 2 +- rdma/rcserver/rcserver_cgo_linux_test.go | 2 +- rdma/rcserver/rcserver_linux.go | 2 +- rdma/rcserver/rcserver_stub.go | 2 +- rdma/rdma.go | 2 +- rdma/rdma_stub.go | 2 +- 23 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 5eed900e..47f15fb9 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/cubackend/cuserver.go b/cubackend/cuserver.go index 0728d1a3..bceebf40 100644 --- a/cubackend/cuserver.go +++ b/cubackend/cuserver.go @@ -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 diff --git a/cubackend/cuserver_stub.go b/cubackend/cuserver_stub.go index 2964917b..81819165 100644 --- a/cubackend/cuserver_stub.go +++ b/cubackend/cuserver_stub.go @@ -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 diff --git a/cuobjclient/session_host_linux.go b/cuobjclient/session_host_linux.go index 151a2359..6bef90ed 100644 --- a/cuobjclient/session_host_linux.go +++ b/cuobjclient/session_host_linux.go @@ -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 diff --git a/cuobjclient/session_linux.go b/cuobjclient/session_linux.go index 6b8374fb..db0f9857 100644 --- a/cuobjclient/session_linux.go +++ b/cuobjclient/session_linux.go @@ -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 diff --git a/cuobjclient/session_stub.go b/cuobjclient/session_stub.go index fb70b762..ea067e5c 100644 --- a/cuobjclient/session_stub.go +++ b/cuobjclient/session_stub.go @@ -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") } diff --git a/cuobjclient/transport.go b/cuobjclient/transport.go index 7a9cfd04..1ded8675 100644 --- a/cuobjclient/transport.go +++ b/cuobjclient/transport.go @@ -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 diff --git a/rdma/hostclient/client_linux.go b/rdma/hostclient/client_linux.go index aa4a553e..db5e2f8e 100644 --- a/rdma/hostclient/client_linux.go +++ b/rdma/hostclient/client_linux.go @@ -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. diff --git a/rdma/hostclient/client_stub.go b/rdma/hostclient/client_stub.go index ff90fe25..e1fe3976 100644 --- a/rdma/hostclient/client_stub.go +++ b/rdma/hostclient/client_stub.go @@ -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 diff --git a/rdma/rcroutes/admin_linux.go b/rdma/rcroutes/admin_linux.go index eb60f23e..a87b4bf8 100644 --- a/rdma/rcroutes/admin_linux.go +++ b/rdma/rcroutes/admin_linux.go @@ -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 diff --git a/rdma/rcroutes/admin_stub.go b/rdma/rcroutes/admin_stub.go index b6d2f742..d9488fce 100644 --- a/rdma/rcroutes/admin_stub.go +++ b/rdma/rcroutes/admin_stub.go @@ -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 diff --git a/rdma/rcroutes/errors_linux.go b/rdma/rcroutes/errors_linux.go index 25b9f4a1..05f335ae 100644 --- a/rdma/rcroutes/errors_linux.go +++ b/rdma/rcroutes/errors_linux.go @@ -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 diff --git a/rdma/rcroutes/errors_mapping_linux_test.go b/rdma/rcroutes/errors_mapping_linux_test.go index 74adc866..0494ee1a 100644 --- a/rdma/rcroutes/errors_mapping_linux_test.go +++ b/rdma/rcroutes/errors_mapping_linux_test.go @@ -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 diff --git a/rdma/rcroutes/errors_stub.go b/rdma/rcroutes/errors_stub.go index 97e1c178..fe818fb9 100644 --- a/rdma/rcroutes/errors_stub.go +++ b/rdma/rcroutes/errors_stub.go @@ -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 diff --git a/rdma/rcroutes/ops_linux.go b/rdma/rcroutes/ops_linux.go index eb8370f0..fac111c6 100644 --- a/rdma/rcroutes/ops_linux.go +++ b/rdma/rcroutes/ops_linux.go @@ -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 diff --git a/rdma/rcroutes/ops_linux_test.go b/rdma/rcroutes/ops_linux_test.go index ae1d6e65..de07ef19 100644 --- a/rdma/rcroutes/ops_linux_test.go +++ b/rdma/rcroutes/ops_linux_test.go @@ -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 diff --git a/rdma/rcroutes/routes_linux.go b/rdma/rcroutes/routes_linux.go index 394d9893..8d136e8d 100644 --- a/rdma/rcroutes/routes_linux.go +++ b/rdma/rcroutes/routes_linux.go @@ -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. diff --git a/rdma/rcroutes/routes_stub.go b/rdma/rcroutes/routes_stub.go index f3b5e03c..00fe86e5 100644 --- a/rdma/rcroutes/routes_stub.go +++ b/rdma/rcroutes/routes_stub.go @@ -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 diff --git a/rdma/rcserver/rcserver_cgo_linux_test.go b/rdma/rcserver/rcserver_cgo_linux_test.go index 7a0c3c52..033b5c14 100644 --- a/rdma/rcserver/rcserver_cgo_linux_test.go +++ b/rdma/rcserver/rcserver_cgo_linux_test.go @@ -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 diff --git a/rdma/rcserver/rcserver_linux.go b/rdma/rcserver/rcserver_linux.go index aad73e0c..72d16c8e 100644 --- a/rdma/rcserver/rcserver_linux.go +++ b/rdma/rcserver/rcserver_linux.go @@ -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. diff --git a/rdma/rcserver/rcserver_stub.go b/rdma/rcserver/rcserver_stub.go index 493e3b1a..ef546320 100644 --- a/rdma/rcserver/rcserver_stub.go +++ b/rdma/rcserver/rcserver_stub.go @@ -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 diff --git a/rdma/rdma.go b/rdma/rdma.go index 07187bf1..04e5de1b 100644 --- a/rdma/rdma.go +++ b/rdma/rdma.go @@ -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 diff --git a/rdma/rdma_stub.go b/rdma/rdma_stub.go index 545622cb..336f8cae 100644 --- a/rdma/rdma_stub.go +++ b/rdma/rdma_stub.go @@ -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.