Added some support for variable->constant substitution in kernels.