// Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include template [[gnu::noinline]] void keep_for_debugger(const T& value) { asm volatile("" : : "g"(&value) : "memory"); } using array_alias = cuda::std::array; [[gnu::noinline]] void inspect_normal(const cuda::std::array& values) { keep_for_debugger(values); } [[gnu::noinline]] void inspect_empty(const cuda::std::array& values) { keep_for_debugger(values); } [[gnu::noinline]] void inspect_nested(const cuda::std::array, 2>& values) { keep_for_debugger(values); } [[gnu::noinline]] void inspect_alias(const array_alias& values) { keep_for_debugger(values); } [[gnu::noinline]] void inspect_before_update(const cuda::std::array& values) { keep_for_debugger(values); } [[gnu::noinline]] void inspect_after_update(const cuda::std::array& values) { keep_for_debugger(values); } int main() { const cuda::std::array normal = {-7, 0, 42}; const cuda::std::array empty = {}; const cuda::std::array, 2> nested = {{{13, -5}, {0, 88}}}; const array_alias alias = {-31, 17, 8, -64}; cuda::std::array updated_values = {6, -91, 52}; inspect_normal(normal); inspect_empty(empty); inspect_nested(nested); inspect_alias(alias); inspect_before_update(updated_values); updated_values = {3, 85, -12}; inspect_after_update(updated_values); }