Whoa, wait a minute, these are completely different things.
Attribute registers are only written inside intersection programs by optixReportIntersection().
There is no optixSetAttribute call, only optixGetAttribute calls.
https://raytracing-docs.nvidia.com/optix7/guide/index.html#device_side_functions#device-side-functions
For questions about how to report intersections, go through these search results for optixReportIntersection()
Read these recent threads instead if you need a bigger per ray payload than fits into 8 32-bit registers.
https://forums.developer.nvidia.com/t/global-payload/159415
https://forums.developer.nvidia.com/t/optic-7-passing-multiple-ray-data-to-closesthit-program/160005