Unified memory counter/s need to be configured before enabling the activity CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER. Did you follow this order?
Activity kind CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER is not supported at the context level, that’s reason cuptiActivityEnableContext throws error CUPTI_ERROR_INVALID_KIND.
Refer CUPTI sample unified_memory for the use case.