Use a device_ptr in expand_active_nodes so that we don't need to use raw_pointer_cast elsewhere.