From 016bf32a025449de5ca0cc631081b2c55a111c1c Mon Sep 17 00:00:00 2001 From: drmckay Date: Wed, 1 Jul 2026 15:49:27 +0200 Subject: [PATCH 1/2] Fix GPU autoencoder: honor target_true_p in produce_autoencoder_example The CUDA method and dispatcher lacked the target_true_p parameter that TMAutoEncoder.fit() passes, so GPU fit() raised TypeError; the body also called a non-existent .choice on the pycuda RNG. Draw target_value host-side biased by target_true_p, matching the CPU path. --- tmu/clause_bank/clause_bank_cuda.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tmu/clause_bank/clause_bank_cuda.py b/tmu/clause_bank/clause_bank_cuda.py index db25cf3b..91cb2fdc 100644 --- a/tmu/clause_bank/clause_bank_cuda.py +++ b/tmu/clause_bank/clause_bank_cuda.py @@ -473,8 +473,8 @@ def prepare_X_autoencoder(self, X_csr, X_csc, active_output): X_gpu ) - def produce_autoencoder_example(self, encoded_X, target, accumulation): - target_value = self.rng_gen.choice(2) + def produce_autoencoder_example(self, encoded_X, target, target_true_p, accumulation): + target_value = int(self.coordinator.host.rng.random() <= target_true_p) self._ensure_context() try: self.produce_autoencoder_examples_gpu.prepared_call( @@ -619,9 +619,9 @@ def prepare_X_autoencoder(self, X_csr, X_csc, active_output): else: return None - def produce_autoencoder_example(self, encoded_X, target, accumulation): + def produce_autoencoder_example(self, encoded_X, target, target_true_p, accumulation): if self.device: - return self.device.produce_autoencoder_example(encoded_X, target, accumulation) + return self.device.produce_autoencoder_example(encoded_X, target, target_true_p, accumulation) else: return None From 06f578628c1bc5f0c039d46855e0d38db6b1a70f Mon Sep 17 00:00:00 2001 From: drmckay Date: Wed, 1 Jul 2026 15:49:27 +0200 Subject: [PATCH 2/2] Fix GPU autoencoder: drop stray host active_output from encoded_X tuple prepare_X_autoencoder left the host active_output array in the tuple that produce_autoencoder_example splats into the launch, giving 14 args for a 13-arg kernel. Only active_output_gpu is a kernel argument; drop the host copy. --- tmu/clause_bank/clause_bank_cuda.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tmu/clause_bank/clause_bank_cuda.py b/tmu/clause_bank/clause_bank_cuda.py index 91cb2fdc..cf36a38f 100644 --- a/tmu/clause_bank/clause_bank_cuda.py +++ b/tmu/clause_bank/clause_bank_cuda.py @@ -462,7 +462,6 @@ def prepare_X_autoencoder(self, X_csr, X_csc, active_output): X_gpu = self._profiler.profile(cuda.mem_alloc, X.nbytes) return ( active_output_gpu, - active_output, int(active_output.shape[0]), X_csr_indptr_gpu, X_csr_indices_gpu,