Hong Kong dialect and Cantonese belong to Guangzhou dialect, while Shanghai dialect belongs to Wu dialect. These two dialects are far apart.
Shanghai dialect generally refers to Shanghai dialect, which is widely used now and is recognized as the mainstream common dialect in Shanghai. Songjiang dialect is the basis of Shanghai dialect.