Tensor Abstraction Enabling Explicit Layout Optimization in Homomorphic Encryption
Fully Homomorphic Encryption (FHE) enables computation directly on encrypted data, making it promising for privacypreserving applications in sensitive domains such as finance and healthcare. Among FHE schemes, RNS-CKKS supports fixed-point arithmetic and SIMD operations, making it particularly suitable for machine learning applications. However, RNS-CKKS imposes significant constraints that make programming inherently challenging. Data must be encoded and encrypted into large vectors with slot counts ranging from N = 2^14 to 2^16, creating a fundamental gap between logical tensor shapes and physical ciphertext layouts. Furthermore, programmers are restricted to only three operations—SIMD addition, multiplication, and cyclic rotation – where all slots must be uniformly processed in each operation. Fhelipe [3] addresses this challenge through full automation of data packing within compiler abstractions, achieving performance gains via sophisticated layout optimizations.
However, this opacity resulting from the full automation prevents debugging of data placement when performance falls short and blocks programmers from applying alternative optimizations that require specific layout configurations. EinHops [2] improves transparency by decomposing operations using einsum notation and providing non-encrypted backends for slot-level debugging. Nevertheless, this design fundamentally limits both debuggability and scalability, because it does not clearly express physical properties such as the slot interval and cannot handle tensors exceeding N/2 slots due to its single-ciphertext constraint.