Clean up GPU code

1. Check the length of total_delay and assert if it not valid.
2. Make macros for PERFORMANCE_METRICS.