Optimize Fence checking performance (#1593)
* For majority of nodes, we do not need to do fence check. Instead, we only need to do FenceCheck for CPU<->GPU mem sync node
But we pay the Fence check cost for every single node and every single input and output.
This change will minimize the Fence check to only do it when necessary.