Skip to content

Commit af42fd8

Browse files
committed
[SymForce] DataBuffers not marked as unused
Topic: sf-databuffer-unused Reviewers: nathan,bradley,harrison,chao,hayk GitOrigin-RevId: 2d99b927990463cbbfd2a1be29c20b9d9713334d
1 parent 04acf8a commit af42fd8

File tree

3 files changed

+5
-7
lines changed
  • symforce/codegen
  • test/symforce_function_codegen_test_data
    • symengine/databuffer_codegen_test_data/cpp/symforce/buffer_test
    • sympy/databuffer_codegen_test_data/cpp/symforce/buffer_test

3 files changed

+5
-7
lines changed

symforce/codegen/codegen.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,11 @@ def unused_arguments(self) -> T.List[str]:
394394
"""
395395
results = []
396396
for input_name, input_value in self.inputs.items():
397-
input_symbols = set(ops.StorageOps.to_storage(input_value))
397+
if isinstance(input_value, sf.DataBuffer):
398+
# DataBuffers have no storage, so we look for their exact symbol
399+
input_symbols = {input_value}
400+
else:
401+
input_symbols = set(ops.StorageOps.to_storage(input_value))
398402
if not input_symbols.intersection(self.output_symbols):
399403
results.append(input_name)
400404
return results

test/symforce_function_codegen_test_data/symengine/databuffer_codegen_test_data/cpp/symforce/buffer_test/buffer_func.h

-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ template <typename Scalar>
2525
Scalar BufferFunc(const Scalar* const buffer, const Scalar a, const Scalar b) {
2626
// Total ops: 8
2727

28-
// Unused inputs
29-
(void)buffer;
30-
3128
// Input arrays
3229

3330
// Intermediate terms (1)

test/symforce_function_codegen_test_data/sympy/databuffer_codegen_test_data/cpp/symforce/buffer_test/buffer_func.h

-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ template <typename Scalar>
2525
Scalar BufferFunc(const Scalar* const buffer, const Scalar a, const Scalar b) {
2626
// Total ops: 9
2727

28-
// Unused inputs
29-
(void)buffer;
30-
3128
// Input arrays
3229

3330
// Intermediate terms (0)

0 commit comments

Comments
 (0)